Viewing 1 replies (of 1 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    What do you want to do? To redefine the shortcode fully?

    You can simply use the statement:

    
    add_shortcode( 'cf7-hcaptcha', [ $this, 'my_cf7_hcaptcha_shortcode' ] );
    

    after \HCaptcha\CF7 class initialization, which happens on plugins_loaded action with the earliest priority: -PHP_INT_MAX.

    So, you can add your own shortcode like this

    
    class My_CF7_Shortcode {
    
    	public function __construct() {
    		add_action( 'plugins_loaded', [ $this, 'add_shortcode' ] );
    	}
    
    	public function add_shortcode() {
    		add_shortcode( 'cf7-hcaptcha', [ $this, 'my_cf7_hcaptcha_shortcode' ] );
    	}
    
    	public function my_cf7_hcaptcha_shortcode() {
    		// Do something...
    	}
    }
    

    This will redefine shortcode by itself, but all the processing (verification) will still work from the hCaptcha plugin.

Viewing 1 replies (of 1 total)

The topic ‘callback function and class in shortcode’ is closed to new replies.