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 in Others by Kichu
• 17,230 points
31 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 by narikkadan
• 7,860 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 in Others by narikkadan
• 7,860 points
78 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 in Others by narikkadan
• 7,860 points
58 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 in Others by narikkadan
• 7,860 points
69 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 in Others by narikkadan
• 7,860 points
28 views
0 votes
1 answer

Problem with yoast SEO

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

answered Feb 10 in Others by narikkadan
• 7,860 points
22 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 in Others by narikkadan
• 7,860 points
51 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 in Others by narikkadan
• 7,860 points
63 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 in Others by narikkadan
• 7,860 points
41 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 in Others by narikkadan
• 7,860 points
170 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 in Others by narikkadan
• 7,860 points
30 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP