-
Hello,
nothing but praise for RankMath, but it apparently has an issue with my Custom Post Types – when I try to add a new custom post, it throws these notices at me:
Trying to get property 'name' of non-object in /home/vagrant/code/hkosig/wp-content/plugins/seo-by-rank-math/includes/admin/metabox/class-post-screen.php on line 426Trying to get property 'labels' of non-object in /home/vagrant/code/hkosig/wp-content/plugins/seo-by-rank-math/includes/admin/metabox/class-post-screen.php on line 426Trying to get property 'singular_name' of non-object in /home/vagrant/code/hkosig/wp-content/plugins/seo-by-rank-math/includes/admin/metabox/class-post-screen.php on line 426This is how I registered my CPTs:
public function hko_cpt() {
register_post_type(
'product',
[
'labels' => [
'name' => __( 'Proizvodi i usluge', 'hko-cpt' ),
'singular_name' => __( 'Proizvod i usluga', 'hko-cpt' ),
],
'public' => true,
'has_archive' => false,
'show_in_rest' => true,
'rewrite' => [
'slug' => 'proizvodi-i-usluge',
],
'supports' => [ 'title', 'custom-fields', 'editor', 'excerpt', 'thumbnail' ],
'menu_position' => 5,
'menu_icon' => 'dashicons-hammer',
]
);
}
Obviously it’s not a fatal error so it doesn’t break the site, but I prefer bug-free coding, so I’d really like to resolve this. ๐
Hopefully you could steer me in the right direction?
Thanks in advance!
The ticket ‘RankMath with Custom Post Types PHP notice’ is closed to new replies.