hooker for do_action() and the action() registration

  • your plugin is a great work for seo admins, thanks for yours work and open source.
    when i study the code of the plugin, there are some missed action in source.
    the code use a hooker for do_action().
    but a lots of action not find the action() registration with the search:
    “$this->action( ” in code base.

    such as:
    class-installer.php:
    $this->do_action( ‘activate’ );
    $this->do_action( ‘deactivate’ );

    class-engine.php
    $this->do_action( ‘admin/loaded’ );

    class-frontend.php
    $this->do_action( ‘frontend/loaded’ );

    class-assets.php
    $this->do_action( ‘admin/register_scripts’ );

    and so on…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I have just raised this issue with our dev team and we will be looking into this shorly and then get back to you.

    We appreciate your patience. Thank you.

    ​​​​​​​

    Hello,

    As you noticed, we are using a wrapper function for all the action/filter hooks in the plugin. The way you can use the hooks, is to prepend rank_math to the hook name. For example the activate hook can be used by attaching a function to the rank_math/activate action, and the frontend/loaded hook can be used with rank_math/frontend/loaded.
    Here is some example code for using the head hook:

    add_action( 'rank_math/head', function() {
    	remove_all_actions( 'rank_math/opengraph/facebook' );
    	remove_all_actions( 'rank_math/opengraph/twitter' );
    });

    You can find more examples on this page: https://rankmath.com/kb/filters-hooks-api-developer/

    Hope that helps. If you have any question, please feel free to ask.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this ticket.