In WordPress, how can I get the error log to see a postID of a page on the load of post.php?

Question

I have tried using get_the_ID(), global $post; error_log(print_r($post->ID,true)), the_ID() and I cannot the post_ID of a page on load in WP. I have added:

add_action( 'load-post.php', 'myFunc' );
add_action( 'post.php', 'myFunc' );
add_action( 'load-post-new.php', 'myFunc' );
function myFunc(){...}

How can I do this?

0
AviG 4 months 0 Answers 13 views 0

Leave an answer