Support » Plugin: Yoast SEO » WPSEO_Frontend_Primary_Category::post_link_category deprecated

  • Resolved arjendejong

    (@arjendejong)


    Hi,

    After the 14.0 update, we’re getting a ErrorException (E_USER_DEPRECATED) on the posts overview page in the WordPress dashboard: WPSEO_Frontend_Primary_Category::post_link_category is <strong>deprecated</strong> since version WPSEO 14.0 with no alternative available.
    We’re using Themosis which is a framework based on Laravel, which means this error is blocking us from viewing the posts overview page. Looking through the SEO plugin code, I can see that the following file wordpress-seo\deprecated\frontend\class-primary-category.php includes the filter without doing anything different than the file at wordpress-seo\src\integrations\primary-category.php, so I was wondering why this deprecation is included at all. Could you shed some light on it?

    • This topic was modified 1 year, 7 months ago by arjendejong.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Joost de Valk

    (@joostdevalk)

    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.

    Thread Starter arjendejong

    (@arjendejong)

    It seems this deprecation error only happens when you have %category% in permalinks:
    https://imgur.com/oHfwb6u
    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:
    https://imgur.com/n2wB6IF
    As you can see, both are from Yoast and the one that’s causing it, is the second filter.

    Thread Starter arjendejong

    (@arjendejong)

    @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 1 year, 7 months ago by misuh2710.
    Plugin Author Joost de Valk

    (@joostdevalk)

    Yeah, I think you can just remove those two lines and it’ll all work as well. Could you test that for me @arjendejong ? ๐Ÿ™‚

    Plugin Author Joost de Valk

    (@joostdevalk)

    So that means removing these two lines:

    
    $primary_term = new WPSEO_Frontend_Primary_Category();
    $primary_term->register_hooks();
    
    Thread Starter arjendejong

    (@arjendejong)

    @joostdevalk I have removed both lines and the error disappeared, so everything is working correctly now.

    • This reply was modified 1 year, 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!

    Thread Starter arjendejong

    (@arjendejong)

    @benmoody This has been fixed in 14.0.1, which is out now. ๐Ÿ™‚

    Just updated, confirmed fixed on my end!

    Thanks again!!

    Plugin Author Joost de Valk

    (@joostdevalk)

    Thanks for testing everyone ๐Ÿ™‚

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WPSEO_Frontend_Primary_Category::post_link_category deprecated’ is closed to new replies.