Support » Plugin: The SEO Framework » How to remove plugin actions

  • Resolved indrek_k

    (@indrek_k)


    Hi there!

    I would like to get rid of Authorial Info in user profile fields. However, I cannot figure out how to remove the relevant actions. I can see they are registered in profile.class.php but there doesn’t seem to be a way to reference the Load class in any way to remove them. Also, in Init class, there’s the action ‘the_seo_framework_after_admin_init’ with a comment added stating that it’s possible to use it to remove actions, but again no way to reference the main class itself.

    Am I not seeing something?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    This should do:

    add_action( 'the_seo_framework_after_admin_init', function() {
    	$tsf = the_seo_framework();
    
    	remove_action( 'show_user_profile', [ $tsf, '_add_user_author_fields' ], 0 );
    	remove_action( 'edit_user_profile', [ $tsf, '_add_user_author_fields' ], 0 );
    
    	remove_action( 'personal_options_update', [ $tsf, '_update_user_settings' ], 10 );
    	remove_action( 'edit_user_profile_update', [ $tsf, '_update_user_settings' ], 10 );
    } );

    For future reference, you can access the object via the_seo_framework() function. We don’t pass the object through actions as it heaps up in the $GLOBALS['wp_actions'] cache size. With over 190 filters and over 55 actions, that can add up quickly!

    Now you know that the_seo_framework() exists, I think you’ll find your way quickly in the future!

    I hope this helps 🙂 Cheers!

    Thread Starter indrek_k

    (@indrek_k)

    Awesome, thanks so much! Totally didn’t notice this function.

    I recommend adding a note about this to https://theseoframework.com/docs/api/actions/ and https://theseoframework.com/docs/api/filters/

    Thanks again!

    Plugin Author Sybre Waaijer

    (@cybr)

    Cheers 🙂

    I couldn’t find a nice way to weave that into those pages, so I’ve added it on the main API page, under “PHP API”.

    I should make a full page explaining how it works… we also have builder-and (soon to come) bridge objects 🤔

    Thread Starter indrek_k

    (@indrek_k)

    Kudos for writing the docs. Not many devs have the patience (or capability) for that.

    We recently moved away from Yoast and this brief conversation with you has confirmed that it was a good choice. Thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to remove plugin actions’ is closed to new replies.