• 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)
  • Thread Starter wpexplorer

    (@wpexplorer)

    Additionally if you try doing get_post_type() it will return “page” instead of “tribe_event” see the example below:

    So it seems like an issue with the templating system.

    Hi wpexplorer

    Just tried your code in the functions.php file of my child classic theme and was getting the correct responses for get_the_ID and get_post_type.

    Then loaded 2021 theme and added your code in that functions.php file – still works OK – all pages, posts, event list & single event pages that I looked at.

    So unable to replicate your issue…

    Thread Starter wpexplorer

    (@wpexplorer)

    Hi,

    Thank you for testing! I did some more troubleshooting and it looks like it’s only an issue when using the “Default Page Template” option for the Enable Event Views setting:

    Hi wpexplorer

    Confirmed same here – interesting to see what TEC support says.

    Plugin Support Darian

    (@d0153)

    Hi @wpexplorer @jim5471

    Thanks for reaching out, and for bringing this to our attention.

    We already created an internal ticket for this one and have added this thread. While we don’t have an ETA, you’ll get notified once there is an update and fix.

    In the meantime, you could try adding the same snippet codes through Code Snippets plugin, and it should return the correct values.

    Please let me know if you have further questions or concerns.

    Regards,
    Darian

    Internal Bug Ticket Reference: BTRIA-1774

    I’m trying to get the event ID (post id) with the get_the_ID() function but it’s returning values ??10000001, 10000002, 10000003…

    I read that this is because CT1 was implemented. How do I get the actual event ID?

    Plugin Support Darian

    (@d0153)

    Hi @srmanager

    It seems the question you’re asking is related to recurring events which is only available in The Events Calendar PRO plugin.

    For us to help you better and follow WordPress Forum Guidelines regarding premium users, please open a Support Ticket on our Help Desk.

    You’ll hear from one of my colleagues soon!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin is breaking get_the_ID()’ is closed to new replies.