Hi @fabx77
The message you’re seeing is a WordPress 6.7+ notice that appears when a theme or plugin loads its translations too early, before the init hook.
The part: “Loading the translation for the graphene domain was triggered too early.” Indicates that somewhere in your snippet you’re loading translations for the graphene text domain. To resolve it, make sure that code runs on or after inithook.
You can share your snippet, and we can review it and suggest the fix.
As for your error_log() calls: seeing the one at the top, but not the ones inside your functions, is expected. The top-level error_log( "Hello" ); runs as soon as the snippet loads, but the logs inside your functions only run when the hooks they’re attached to actually fire. If you’re not seeing those entries, it likely means the action or event they’re hooked to isn’t triggered on the page you’re testing.
Thanks,
Thread Starter
fabx77
(@fabx77)
Good evening,
Thank you so much for your reply!!!
Indeed, I’m not very comfortable with hooks…
Here’s a very early version of my code:
// // Create a cron job to run the day after an event happens or ends
function set_expiry_date( $post_id ) {
error_log( 'start of function' );
// See if an event_end_date or event_date has been entered and if not then end the function
if( get_post_meta( $post_id, $key = 'event_end_date', $single = true ) ) {
// Get the end date of the event in unix grenwich mean time
$acf_end_date = get_post_meta( $post_id, $key = 'event_end_date', $single = true );
} elseif ( get_post_meta( $post_id, $key = 'event_date', $single = true ) ) {
// Get the start date of the event in unix grenwich mean time
$acf_end_date = get_post_meta( $post_id, $key = 'event_date', $single = true );
} else {
// No start or end date. Lets delete any CRON jobs related to this post and end the function.
wp_clear_scheduled_hook( 'make_past_event', array( $post_id ) );
return;
}
}
// ....
.....
.....
// Hook into the save_post_{post-type} function to create/update the cron job everytime an event is saved.
add_action( 'acf/save_post', 'set_expiry_date', 20 );
The error_log “Start of function” within the function never appears in the debug.log file, so I deduce that the function is never called…
Thank you so much again for your help!!! :-))
-
This reply was modified 1 month, 2 weeks ago by
fabx77.