Detect Yoast SEO plugin

0 votes
function active( $plugin ) {
    $network_active = false;
    if ( is_multisite() ) {
        $plugins = get_site_option( 'active_sitewide_plugins' );
        if ( isset( $plugins[$plugin] ) ) {
            $network_active = true;
        }
    }
    return in_array( $plugin, get_option( 'active_plugins' ) ) || $network_active;
}

if ( active( 'wordpress-seo/wp-seo.php' ) {


I used this function to detect yoast seo and it wiorks but if the yoast seo is renamed then it wont work so i need a backup  
Feb 12, 2022 in Others by Kichu
• 19,050 points
871 views

1 answer to this question.

0 votes
if(in_array('wordpress-seo/wp-seo.php', apply_filters('active_plugins', get_option('active_plugins')))){
    /* Yoast is active */
}

use this code this is the safest way to do it there are  other options too but this one doesnt have any disadvantage
answered Feb 14, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

How to add meta keyword in wordpress using yoast seo plugin.?

if you dont want to use code ...READ MORE

answered Feb 12, 2022 in Others by narikkadan
• 63,420 points
766 views
0 votes
1 answer

Setting a custom canonical URL in Yoast Wordpress SEO Plugin

function design_canonical($url) { global ...READ MORE

answered Feb 27, 2022 in Others by narikkadan
• 63,420 points
977 views
0 votes
1 answer

How to Remove canonical tag added by Yoast SEO plugin

first  Log in to your WordPress website ...READ MORE

answered Feb 28, 2022 in Others by narikkadan
• 63,420 points
810 views
0 votes
1 answer

adding meta keyword in wordpress using yoast seo plugin.

You can use Advance Custom Fields plugin ...READ MORE

answered Feb 28, 2022 in Others by narikkadan
• 63,420 points
1,409 views
0 votes
1 answer

Problem with yoast SEO

This is (probably) not a problem of ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,420 points
305 views
0 votes
1 answer

how to show the <meta> values of yoast seo with some function?

check this folder : wordpress-seo\src\presenters\open-graph you can ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,420 points
408 views
0 votes
1 answer

How to echo WP SEO Yoast synonyms in PHP?

 the meta_key in wp_postmeta table is _yoast_wpseo_keyword ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,420 points
926 views
0 votes
1 answer

Yoast SEO remove og description and twitter description on certain page

try this out it wil help ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,420 points
415 views
0 votes
1 answer

Removing canonical tag added by Yoast SEO plugin

first  Log in to your WordPress website ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,420 points
2,335 views
0 votes
1 answer

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

get_post_meta(), use this to get the meta ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,420 points
1,270 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP