add_action in a custom plugin

It errors because class method is not a function. It’s not uniquely identified by its name alone. You need to provide instance of the object (or name of the class for static methods). In your context it would be: add_action( ‘init’, [ $this, ‘newsletterSuscriber’ ] );

How to get a single hook from wp_head()?

wp_head is an essential part of the theme, and there is too many things that might fall apart if it is not there. Hunting and fixing them one by one might be time consuming and the worthiness of the all operation questionable. In you snippet for example you want to remove things that make no … Read more

Add custom action in post type

I found this solution here: WP plugin that add a button to post edit page that allow sending a notify to a contributor whose a post was not approved. It’s possible customize the message including the reason for rejected approval. https://github.com/Giuseppe-Mazzapica/GMRejectNotify I have not tested it but it seems legit!

Inject HTML meta tag inside wordpress tag using add_shortcode

First thing, wp_head action hook does not accept any argument at all, so am not sure whether the $url variable will be passed. To run the short code properly, you have to call do_shortcode(): add_action( ‘wp_head’, ‘refresh_page’ ); function refresh_page() { echo do_shortcode( “[refresh url=”http://stackoverflow.com”]” ); } add_shortcode( ‘refresh’, ‘refresh_shortcode’ ); function refresh_shortcode( $atts ) … Read more