• Home
  • Features
    • Membership Software
    • Member Directory
    • Event Calendar & Registration
    • Member Billing & Online Payments
    • Donations, Shopping Carts & Forms
    • Job Board
    • Announcement Board
    • Classified Ads
    • Members Only Website
    • Website Integration
      • WordPress
      • Squarespace
      • Weebly
      • Without Code
      • Duda
      • Wix
      • HTML5
    • Integrations
    • International
  • Sign Up
    • Pricing & Sign Up
  • Customers
    • Customer Sign In
    • Getting Started
      • MembershipWorks Hosted Website
      • WordPress Plugin
      • Squarespace
      • Weebly
      • Without Code
      • Wix
      • HTML5
    • Customer Websites
  • Developers
    • Find a Developer
    • Create a Developer Listing
    • Manage Developer Listing
  • Demo
    • WordPress Demo
    • Squarespace Demo
    • Weebly Demo
    • Without Code Demo
    • Duda Demo
    • Wix Demo
    • Video Demo of Admin
    • Schedule a Personal Demo
  • About
    • Contact Us
    • Cancel/Suspend Account
    • Schedule a Personal Demo
    • Schedule a Personal Training Session
    • Our Blogs
      • Guides
      • Best Practices
      • Secret Confessions of an ED
      • WordPress with the Light On
    • New Features
    • Careers
    • System Status
Schedule Demo

Discover our membership software with a one-on-one personalized demo:

Schedule a Demo
CMS Integrations

Integrate with WordPress, SquareSpace, Weebly and more.

Learn More!
MembershipWorkslogo

Disabling WordPress SEO Plugins on a Page by Page Basis

Posted on Jul 29, 2013 by Aikmeng KuahJan 9, 2020
seo

WordPress plugin and theme developers may sometimes find the need to output your own open-graph tags, meta descriptions or titles, for specific pages. But one consideration is if your user is running a SEO plugin, such as the Yoast WordPress SEO plugin or the All-In-One SEO Pack. You don't want your plugin or theme to output a second set of open-graph or meta tags, so being able to disable those plugins as needed, within your code, would be a plus.

Disabling the Yoast SEO and All-In-One SEO plugins (the two most common SEO plugins) for a particular page isn't too difficult, although it is not documented as far as I could tell. You do need to hook onto an action or filter before the "wp_head" runs. A good place is with the "wp_title" filter:

function my_title($title,$separator,$position) {
if (condition) {
remove_action('wp_head','jetpack_og_tags'); // JetPack
if (defined('WPSEO_VERSION')) { // Yoast SEO
global $wpseo_front;
remove_action('wp_head',array($wpseo_front,'head'),1);
}
if (defined('AIOSEOP_VERSION')) { // All-In-One SEO
global $aiosp;
remove_action('wp_head',array($aiosp,'wp_head'));
}
remove_action('wp_head','rel_canonical');
remove_action('wp_head','index_rel_link');
remove_action('wp_head','start_post_rel_link');
remove_action('wp_head','adjacent_posts_rel_link_wp_head');
add_action('wp_head','my_head',0);
// do whatever you need to $title here
}
return $title;
}
add_filter('wp_title','my_title',20,3);

Replace "condition" with whatever condition you use to check if this is the page to disable the SEO plugins on. In addition to disabling the Yoast SEO plugin and All-In-One SEO plugin, you see that we also disabled the JetPack open-graph tags, as well as the standard WordPress rel_canonical and rel_link actions. If you want to keep any of those actions, you should remove the appropriate lines.

Finally, the function adds your own 'wp_head' function - 'my_head' where you inject the meta tags, meta descriptions, open-graph tags, as you see fit.

GoToOlder PostNewer PostAll PostsWordPress with the Light On

About Aikmeng Kuah

I'm co-founder and CTO of MembershipWorks. I've been writing code since the Apple II, in a variety of languages including x86 assembly, 68000 assembly, Pascal, Prolog, dBase, C, LISP, SQL, PHP and Javascript. I work on the full stack, from the web site design, front-end web app, back-end servers, database and API. I am a graduate of Carnegie Mellon University (BS) and University of Texas at Austin (PhD).View all posts by Aikmeng Kuah

3 comments

  1. Allex on Aug 22, 2013 at 6:42 am
    Thanks for the above code, but when I tried to replace condition with is_tax ( 'product_cat' ) it still use Yoast WordPress SEO settings. What I want is to disable Yoast SEO in product_cat taxonomy archive, can you help me?
    • Aikmeng Kuah on Aug 29, 2013 at 2:06 am
      Most likely your condition is not actually evaluating to true. The easiest way would be to add a little bit of text to the $title that you can then look for in the html. With a little search, I have also found that lots of people have trouble with the is_tax(‘product_cat’) conditional for WooCommerce. Apparently you have to use the taxonomy slug, not the proper name or id.
  2. Carolyne on Jan 1, 2014 at 5:42 am
    How do I remove the Yoast seo plugin! from my wordpress website, help I don't want it!!!

Comments are closed.

  • Home
  • Features
  • Sign Up
  • Customer Sign-In
  • Terms of Service / Privacy
  • Developers
  • Contact