Skip to content

Instantly share code, notes, and snippets.

@jasonyingling
Last active November 25, 2018 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonyingling/97e3b699d48982051952f5c37af88fde to your computer and use it in GitHub Desktop.
Save jasonyingling/97e3b699d48982051952f5c37af88fde to your computer and use it in GitHub Desktop.
Remove Reading Time from specific posts
add_action( 'the_post', 'remove_reading_time_by_id' );
function remove_reading_time_by_id( $post_object ) {
$post_ids = array(
'53',
'10',
);
global $reading_time_wp;
if ( in_array( $post_object->ID, $post_ids ) ) {
remove_filter( 'the_content', array( $reading_time_wp, 'rt_add_reading_time_before_content') );
} else {
add_filter( 'the_content', array( $reading_time_wp, 'rt_add_reading_time_before_content') );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment