2016-12-13 14 views
0

我對PHP幾乎一無所知,我需要幫助。我有一個WordPress插件,我想更改此代碼:更改一行「get_edit_post_link」

{ 
    $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'; 
} 

問題是......我不想編輯該帖子。我只是想被重定向到文章文章。

你可以看到我想要的enter image description here]

謝謝!

+0

您使用哪個插件?查看插件文檔以查看它是否具有「get_post_link()」函數會很有幫助。 –

+0

這是插件:https://wordpress.org/plugins/report-content/ – Joe

回答

0

的插件使用下面的函數在report-content.php在行242獲得文章的網址:

get_post_permalink()

您可以更改代碼才能使用此功能如下:

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

This鏈接有關於get_post_permalink()函數的更多信息。

請注意,我沒有這個插件安裝,所以我還沒有能夠測試這種變化。

+0

現在改變和工作。非常感謝你。 :-) – Joe

+0

@joe沒有問題! :) –

+0

我還有一個問題。可以在Report Content插件中添加一個函數或其他內容,向我展示任何報告我網站內容的用戶的IP地址?對垃圾郵件發送者好,我需要這樣的東西。 :) – Joe