Plugin is breaking get_the_ID()
-
It seems like the plugin is polluting the global post object on single events (maybe elsewhere but this is where I’m testing). You can do a simple test by adding some code like this to to your site:
add_action( 'wp_head', function() { var_dump( get_the_ID() ); }, 1000 );
If you visit a single post you will see that the return value is “0” instead of the actual post id. Now, I tested with all the default WP themes and this appear to only be an issue in non-block based themes. So the issue is present in the 2021 theme but not the 2023 theme for example.
This is a concern for plugins/themes that require getting the current post ID in the wp_head hook.
Thank you for looking into this!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Plugin is breaking get_the_ID()’ is closed to new replies.