Last active
May 3, 2021 19:35
-
-
Save amboutwe/c186b93dc4a6bc74256308070537bd1e to your computer and use it in GitHub Desktop.
Disable Yoast SEO Primary Category Feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Disable Yoast SEO Primary Category Feature | |
* Credit: Yoast development team | |
* Last Tested: Jan 24 2017 using Yoast SEO 4.1 on WordPress 4.7.1 | |
*/ | |
add_filter( 'wpseo_primary_term_taxonomies', '__return_empty_array' ); |
@elvismdev Thanks for the feedback.
Where should I enter the above code?
functions.php
Thanks! Works perfectly! :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is the right way to fully disable this now:
When using
__return_false
it drops me a PHP notice in the backend:Notice: Trying to get property of non-object in /vagrant/public/wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php on line 189