Skip to main content
added 269 characters in body
Source Link
Scott Helme
  • 271
  • 1
  • 2
  • 9

I have made some custom changes to the file wp-includes\comment-template.php. These changes are periodically lost and I assume it's related to updates for WordPress and the file is modified/re-written.

I have changed:

$comments_link = get_permalink( $post_id ) . '#comments';

To:

$comments_link = get_permalink( $post_id ) . '#disqus_thread';

Is there a way I can persist these changes so they are not lost? Or perhaps there is a better way to make these changes?

Edit

I've tried this code in my themes functions.php file.

function custom_comments_link($comments_link, $post_id){
    return get_permalink($post_id) . '#disqus_thread';
}
add_filter('get_comments_link', 'custom_comments_link', 10, 2);

I have made some custom changes to the file wp-includes\comment-template.php. These changes are periodically lost and I assume it's related to updates for WordPress and the file is modified/re-written.

I have changed:

$comments_link = get_permalink( $post_id ) . '#comments';

To:

$comments_link = get_permalink( $post_id ) . '#disqus_thread';

Is there a way I can persist these changes so they are not lost? Or perhaps there is a better way to make these changes?

I have made some custom changes to the file wp-includes\comment-template.php. These changes are periodically lost and I assume it's related to updates for WordPress and the file is modified/re-written.

I have changed:

$comments_link = get_permalink( $post_id ) . '#comments';

To:

$comments_link = get_permalink( $post_id ) . '#disqus_thread';

Is there a way I can persist these changes so they are not lost? Or perhaps there is a better way to make these changes?

Edit

I've tried this code in my themes functions.php file.

function custom_comments_link($comments_link, $post_id){
    return get_permalink($post_id) . '#disqus_thread';
}
add_filter('get_comments_link', 'custom_comments_link', 10, 2);
Source Link
Scott Helme
  • 271
  • 1
  • 2
  • 9

How to maintain changes to comment-template.php

I have made some custom changes to the file wp-includes\comment-template.php. These changes are periodically lost and I assume it's related to updates for WordPress and the file is modified/re-written.

I have changed:

$comments_link = get_permalink( $post_id ) . '#comments';

To:

$comments_link = get_permalink( $post_id ) . '#disqus_thread';

Is there a way I can persist these changes so they are not lost? Or perhaps there is a better way to make these changes?