0

I know almost nothing about PHP and I need help. I have a WordPress plugin, and I want to change this code:

{
    $post = get_post($item['post_id']);

    if (is_a($post, 'WP_Post'))
        return '<a href="' . get_edit_post_link($post->ID) . '#wprc-reports">' . $post->post_title . '</a>';

    return 'Post Not Found';
}

the problem is...I don't want to edit that post. I just want to be redirected to the post article.

You can see what I want enter image description here].

Thank you!

Blip
  • 3,061
  • 5
  • 22
  • 50
Joe
  • 3
  • 1
  • Which plugin are you using? It can be helpful to view the plugin docs to see if it has, for instance a `get_post_link()` function. – Daniel_ZA Dec 13 '16 at 09:43
  • This is the plugin: https://wordpress.org/plugins/report-content/ – Joe Dec 13 '16 at 09:48

1 Answers1

0

The plugin uses the following function in report-content.php at line 242 to obtain a post's URL:

get_post_permalink()

You can change the code to use this function as follows:

if (is_a($post, 'WP_Post'))
  return '<a href="' . get_post_permalink($post->ID) . '#wprc-reports">' . $post->post_title . '</a>';

This link has more information about the get_post_permalink() function.

Please note that I do not have this plugin installed, so I have not yet been able to test this change.

Daniel_ZA
  • 574
  • 11
  • 26
  • I have one more question. Can be added a function or something in Report Content plugin, to show me IP address from any user who report any content in my website? Is good for spammers and i need something like this. :) – Joe Dec 13 '16 at 10:46
  • http://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php - this question has some good answers on obtaining the clients IP – Daniel_ZA Dec 13 '16 at 11:14