I'm trying to look around over Google of how to hook the add_action
and change the priority of Yoast Canonical,
from: 20
add_action( 'wpseo_head', array( $this, 'canonical' ), 20 );
to: 55
add_action( 'wpseo_head', array( $this, 'canonical' ), 55 );
This affect the position from the frontend head tag section. Is there a way to manipulate this function to hook it inside my functions.php
file?
Note: I tried to copy and paste this to my function, but hook is not reaching the action.
Updated Response Fig. 1
global $wpseo;
$wpseo = new WPSEO_Frontend();
remove_action( 'wpseo_head', array( $wpseo, 'canonical' ), 20 );
add_action( 'wpseo_head', array( $wpseo, 'canonical' ), 55 );
I tried using this as I can see the WPSEO_Frontend
was the declared class where the add_action( 'wpseo_head', array( $wpseo, 'canonical' ), 20 );
is located... But ended-up to broken site.
canonical
. They just give me a go signal to freely modified the plugin, but the question is, what will happen if someone updated the premium plugin of Yoast... For sure it will overwrite my simple code there again.