• Resolved Craig

    (@spedadvocate)


    I need to programatically modify the end date. I have tried using the wordpress publish hook (add_action(‘publish_tribe_events’, ‘fix_end_date’, 999,2);) and rest_after_insert hook (add_action(‘rest_after_insert_tribe_events’, ‘fix_time_date’, 999, 2);) to no avail. Do I have the post-type wrong? I have tried all of the following as well:

    	update_post_meta($ID, '_EventEndDate','2029-12-25 17:00:00');
    	update_post_meta($ID, '_EventEndDateUTC','2029-12-25 22:00:00');
    	$_POST['_EventEndDate']='2029-12-25 17:00:00'; 
    	$_POST['_EventEndDateUTC']='2019-12-05 22:00:00'; 

    Any ideas?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Craig.
    I stumbled upon your post in search for the same answer.
    In my case the problem was, that I setup the rest hook too late.
    You may want to check out which hooks are running in your request. Something like this, perhaps: This function will log all hooks to your errorlog:

    $debug_tags = array();
    add_action( ‘all’, function ( $tag ) {
    global $debug_tags;
    if ( in_array( $tag, $debug_tags ) ) {
    return;
    }
    error_log(“HOOK: $tag”);
    $debug_tags[] = $tag;
    } );

    Hope it helps.

    Thread Starter Craig

    (@spedadvocate)

    Wow, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modify meta with publish hook not working’ is closed to new replies.