Hey Arjen,
We’ve deprecated it because we’re moving to API Surfaces for all these APIs so we give ourselves more flexibility in restructuring and namespacing our code.
How I can fix this error? I downgraded because of this. I’m using Soledad theme.
It seems this deprecation error only happens when you have %category% in permalinks:
View post on imgur.com
All other tags work correctly, because with these tags the post_link_category isn’t being called.
These are the filters $wp_filter['post_link_category'] running on the wp-admin/edit.php page:
View post on imgur.com
As you can see, both are from Yoast and the one that’s causing it, is the second filter.
@joostdevalk I see that wordpress-seo\admin\class-primary-term-admin.php:25 still uses the class with the deprecated function (WPSEO_Frontend_Primary_Category). It’s probably not the right way of including the class, but when I change that to Yoast\WP\SEO\Integrations\Primary_Category (the new one), the error disappears.
Can you give a step my step solve to this problem?
Thank you so much and I’m sorry if I’m asking much.
I’m using category in permalink but I can’t change it because it will destroy all my links.
-
This reply was modified 5 years, 7 months ago by
misuh2710.
Yeah, I think you can just remove those two lines and it’ll all work as well. Could you test that for me @arjendejong ? π
So that means removing these two lines:
$primary_term = new WPSEO_Frontend_Primary_Category();
$primary_term->register_hooks();
@joostdevalk I have removed both lines and the error disappeared, so everything is working correctly now.
-
This reply was modified 5 years, 7 months ago by
arjendejong.
Thank you so much. Problem fixed removing those two lines.
Can confirm that commenting out lines:
wordpress-seo\admin\class-primary-term-admin.php:25
wordpress-seo\admin\class-primary-term-admin.php:26
Removes the php warning. Hopefully no longer instantiating that class doesn’t have any negative effects.
@joostdevalk Will this be removed/addressed in future updates. I never feel comfortable with altering 3rd party plugin code directly like this.
Thanks again for the support and the awesome plugin!
@benmoody This has been fixed in 14.0.1, which is out now. π
Just updated, confirmed fixed on my end!
Thanks again!!
Thanks for testing everyone π