Trying to get property of non-object
-
The global $post can be null e.g. on 404 pages.
This part:
if ( ! isset( $this->templates[ get_post_meta( $post->ID, '_wp_page_template', true ) ] )
from
https://plugins.trac.wordpress.org/browser/blank-slate/tags/1.1.2/blank-slate.php#L127
can therefore generate the error:
Trying to get property of non-object
There should be at least an extra check, e.g. to make sure it’s a
WP_Post
instance or a restriction to only consider those template parts that can use the blank slate template.I also wonder if more specific types of filter would help here, e.g.
{$type}_template_hierarchy
where$type
can be e.g.single, singular, page, ...
Best regards
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Trying to get property of non-object’ is closed to new replies.