there is WP notice after installing a Yoast
-
Dear sir,
I have a classified Theme installed on my website; it works well.
However, after I installed Yoast plugin, it generates error or notice as on this link:
I dont have other third party plugins installed on my website except the Theme plugins.
Can you please advise how to resolve the above issue?
Many thanks in advance.
The page I need help with: [log in to see the link]
-
@daro2013 Can you please confirm whether the error appears when Yoast SEO and a default theme such as TwentyNineteen is active? If the error does not appear when a default theme and Yaost SEO are active, the error is being caused by the theme, and not the Yoast SEO plugin. In that event we’d recommend reporting it to their developers, and checking to see if an update is available.
Test this on your development or staging site, if you have one. If not, we recommend using the?Health Check & Troubleshooting?plugin. This plugin allows you to run a conflict check?without affecting normal visitors to your site.
If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process:?How to check for plugin conflicts
Dear Sir,
Thank you for a quick support.
-I did install your plugin on another domain with Fresh installation of the same theme, there are no errors.
-This happens on my live site, but all third party plugins have been disabled; and I also reversed it to parent theme; the errors still exist.
-I very appreciate if you could help advise how to resolve that error:
Notice: Trying to get property ‘count’ of non-object in /wp-includes/class-wp-term-query.php on line 768
-and the actual codes for that error in class-wp-term-query.php is:
if ( $child->count ) {
continue 2;-in the block of codes:
if ( $hierarchical && $args[‘hide_empty’] && is_array( $terms ) ) {
foreach ( $terms as $k => $term ) {
if ( ! $term->count ) {
$children = get_term_children( $term->term_id, $term->taxonomy );
if ( is_array( $children ) ) {
foreach ( $children as $child_id ) {
$child = get_term( $child_id, $term->taxonomy );
if ( $child->count ) {
continue 2;
}
}
}// It really is empty.
unset( $terms[ $k ] );
}
}
}Cheers
DaroThanks for your confirmation. We looked at your site https://www.bn3dfgt5.info/ and couldn’t find the relevant PHP notice on there. Can you please confirm where exactly do you see the relevant PHP notice?
On the other hand, if you are unable to reproduce the same issue on a fresh WordPress installation with the same theme active alongside the Yoast SEO plugin, this is an issue specific to your current setup.
You’ll need to make sure that you are running the latest version of everything and try switching the theme to the default 2020 theme to see if you still experience the same issue on the current setup.
You should enable debug backtrace (to see all involved methods/functions not only the last in the chain). You can use xdebug PHP extension, Query Monitor or custom PHP code to log/see full debug backtrace.
More details:
https://www.php.net/manual/en/function.debug-backtrace.php
https://gist.github.com/jrfnl/5925642PS: It’s possible that “children cache” is corrupted. You should delete option category_children (or product_cat_children depends on taxonomy) to force WP core to regenerate this cache.
Thank you for all supports.
The errors are generated on Admin backend on Custom Post Type pages (Add New or Edit):
https://www.bn3dfgt5.info/wp-admin/post-new.php?post_type=ait-item
https://www.bn3dfgt5.info/wp-admin/post.php?post=2667&action=edit
@md Mazedul Islam Khan – I can give credentials for FTP and WP Admin to you to help find out the bug. Can I send them to you by email?
@sa?a – PS: It’s possible that “children cache” is corrupted. You should delete option category_children (or product_cat_children depends on taxonomy) to force WP core to regenerate this cache.
How can I delete it?Many thanks
@sa?a I have use this wp-config.php template as you suggested:
https://gist.github.com/jrfnl/5925642
to track the bugs. After I put them in my wp-config.php (keeping all DB details untouched), the WP Admin completely broke up on the above pages (but the front end still displayed as normal):
https://www.bn3dfgt5.info/wp-admin/post-new.php?post_type=ait-item
https://www.bn3dfgt5.info/wp-admin/post.php?post=2667&action=edit
which show the following error:
Fatal error: Uncaught Error: Call to undefined function nocache_headers() in /home/bn5fd0ohg2a6fdbh/public_html/bn3dfgt5.info/wp-admin/admin.php:36 Stack trace: #0 /home/bn5fd0ohg2a6fdbh/public_html/bn3dfgt5.info/wp-admin/post.php(12): require_once() #1 {main} thrown in /home/bn5fd0ohg2a6fdbh/public_html/bn3dfgt5.info/wp-admin/admin.php on line 36
I had a look at /wp-admin/admin.php in line 36, there is a function called:
nocache_headers();
which causes such error. However, I also checked the fresh installation of theme with Yoast on another domain, that function does exist too.
So the cache may cause this kind of error?
Cheers
Update: I installed and activate Query Monitor plugin as advised by @sa?a, and identified some tracks of bugs in relation to Yoast plugin.
Here are the details:
wp-includes/class-wp-term-query.php:768
WP_Term_Query->get_terms()
wp-includes/class-wp-term-query.php:297
WP_Term_Query->query()
wp-includes/taxonomy.php:1221
get_terms()
wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php:265
WPSEO_Primary_Term_Admin->map_taxonomies_for_js()
Unknown location
array_map()
wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php:248
WPSEO_Primary_Term_Admin->get_mapped_taxonomies_for_js()
wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php:128
WPSEO_Primary_Term_Admin->enqueue_assets()
wp-includes/class-wp-hook.php:287
do_action(‘admin_enqueue_scripts’)
wp-admin/admin-header.php:102Please advise how to fix them.
Cheers
It seems that’s an issue with primary category.
Please try to flush object cache or delete transients if you don’t have object cache. Try to edit some child term (category), it’ll regenerate “category_children”.
Have you installed any multi-language plugin?
@sa?a
Yes, I have installed multi-language plugin. I also use WP-Rocket.
-I think I dont have Object cache on my wordpress after I issued this command in /public_html/:
wp cache flush
Error:
-bash: wp: command not found-I have cleared all caches in WP Rocket as well as in the following folders:
/wp-content/uploads/cache/
/wp-content/cache/-I have also clear The theme cache too which is a bult-in cache.
-I use both WP-Rocket to clean up Transients cache and use Transients manager plugin to delete them. However, there are 15 transients cache left which cannot be deleted by that plugin, and 5 of them belong to Yoas plugin.
How can I delete those transients cache completely so that the theme or plugins can generate new ones?
Cheers
Update: I have run the following command in SSH:
wp cache flush
wp transient delete –allThe WP notice still exist on both two pages above at Admin backend. However, instead of showing over 250 notices with same line, now it displays only two lines like this:
Notice: Trying to get property ‘count’ of non-object in /wp-includes/class-wp-term-query.php on line 768
Notice: Trying to get property ‘count’ of non-object in /wp-includes/class-wp-term-query.php on line 768
Both of them are related to Yoast plugin based on Query Monitor.
Is there any other cache I have to delete to fix the above WP notice?
Many thanks in advance.
Hi,
We are not familiar with the transient caches which are not Yoast, so you will need to contact the theme/plugin which is responsible for making them.
With Yoast, can you describe exactly what these transient caches are?
And moreover, the 15 transient cache I see in Query Monitor still there. Basically they have not been deleted at all after I issued the 2 commands above.
Also some other WP notices not related to Yoast plugin have also been gone; not seen any more.
Therefore CACHE does cause WP notices as advised by the gentlement @sa?a
Any advice is very appreciated.
@pcosta88 I dont know much too about Transient cache which is stored in DB by the theme and plugin for a specific period for better performance. Please read here:
https://www.wpbeginner.com/plugins/how-to-manage-and-delete-transients-in-wordpress/
AIT Theme uses Yoast plugin as its default SEO plugin (although not built-in Yoast on AIT Theme). Their support is very limited, and if AIT theme developers know Yoast works well on AIT Theme, they would not help me. I can try to open a ticket for that to see what AIT theme tech support say.
It is very weird this WP notice has come up quite long ago as I dont turn on WP debug mode.
Any advice how to fix this error is very appreciated.
Cheers
@daro2013 The command has removed all transients, but first access (even to you check transients) will show few transients. It’s expected behavior.
If you have access to SSH/WP-CLI then you can try to remove “children options”:
wp option delete category_children wp option delete category_children_en wp option delete category_children_de
After this, you can try:
wp term list category
to see is it working without notices.Which is lang plugin? WPML or something else?
@pcosta88 please find screenshot in this link:
https://bn3dfgt5.info/yoast1.jpg
and
https://bn3dfgt5.info/yoast2.jpgYou can see that Transients Manager plugin lists 5 transient cache related to Yoast plugin (yoast1.jpg)
and Query Monitor plugin identifies the WP notice in relation to Yoast plugin too (yoast2.jpg)
Cheers
- The topic ‘there is WP notice after installing a Yoast’ is closed to new replies.