Answer the question
In order to leave comments, you need to log in
Why is $post->ID suddenly "property of non-object"?
Hello.
I'm trying to add editor styles that will be connected dynamically depending on the id of the post being edited.
More or less like this:
function give_me_post_id(){
global $post;
return $post->ID;
}
add_editor_style( get_stylesheet_directory_uri() . '/css/editor-style-' . give_me_post_id() . '.css' );
PHP Notice: Trying to get property of non-object in /home/h59971/data/www/site.com/wp-content/themes/mytheme/functions.php on line 140
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question