A minor peeve is when plugins rely on the_content
filter, to add some code or functionality which should not actually part of content at all!
The average site visitor would not typically notice, but tacking on extra markup this way will have it showing up in RSS feeds, and ActivityPub status! 😱
Often the reason to use the_content
in the first place is because we need access to info about the current post. A better approach to accessing the post data is to use get_queried_object().
$queried_object = get_queried_object();
if ( $queried_object ) {
$post_id = $queried_object->ID;
// Continue with your logic
}
Leave a Reply