where is the documentation for add_action() parameters?

those parameters aren’t unique to the_posts, they’re parameters for the add_action() function add_action( $tag, $function_to_add, $priority, $accepted_args ); the 10 is just the default priority and 1 is the default number of accepted arguments. since they’re both default, you don’t really need either. http://codex.wordpress.org/Function_Reference/add_action

Mustn’t do_action be accompanied with a function?

The param used in do_action isn’t a function is just a tag that represents the action called, the proper way to use an action is attaching functions with add_action. You can learn more from https://developer.wordpress.org/reference/functions/do_action/

WP action is not triggering a do_action() call within?

I’ve taken you example and reduced it to this functioning test case: class ClassOne { public static function do_something() { do_action( ‘my_action_1’ ); do_action( ‘my_action_2’ ); } } class ClassTwo { function __construct() { add_action( ‘my_action_2’, [ $this, ‘my_action_2’ ] ); add_action( ‘my_action_1’, [ $this, ‘my_action_1’ ] ); } public function my_action_2() { print “My … Read more

Preventing frontpage to be deleted/moved to trash

There are two problems with your code snippet: 1) Comparison The first problem is in this line: if( $post_id === $frontpage || $post_id === $blogpage ) { where you’re strictly comparing int with string. Notice that === comparison will only return TRUE if both variables are of the same type and have the same value. … Read more

Usage of do_action and add_adction

You need to echo your data. Try this instead – function add_link_to_aff() { $html_output = “<li><a href=”#”>” . __( ‘Test’, ‘yith-woocommerce-affiliates’ ) . “</a></li>”; echo $html_output; } add_action( ‘yith_wcaf_after_dashboard_links’, ‘add_link_to_aff’, 10 );

Unable to show error message using wp_login action

Main problem with your code is that you use wp_login action. The wp_login action hook is triggered when a user logs in by the wp_signon() function. It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call. So first of all – the user is already authenticated and his auth cookie … Read more

use add_action(‘wp_head’) in a widget

You can call wp_enqueue_script() directly in your Widget output, and WordPress will enqueue the script. No need to add it to a callback. Try changing this: else { add_action(‘wp_head’, ‘pieChartScripts’); function pieChartScripts() { wp_register_style(‘piechart-css’, get_template_directory_uri() . ‘/css/jquery.easy-pie-chart.css’); wp_enqueue_style(‘piechart-css’); } wp_register_script(‘piechart’, get_template_directory_uri() . ‘/js/jquery.easypiechart.min.js’, ”, ‘2.0.4’); wp_enqueue_script(‘piechart’); // etc } …to this: else { wp_register_style(‘piechart-css’, get_template_directory_uri() … Read more

When should I call add_settings_section and add_settings_field?

You can call add_settings_section and add_settings_field any time before you do_settings_sections: add_action( ‘my_plugin_add_settings_sections’, function() { wp_remote_get( … ); add_settings_section( … ); add_settings_field( … ); }); // On the plugin settings page output do_action( ‘my_plugin_add_settings_sections’ ); do_settings_sections( … ); You’ll still want to register_setting() earlier though because that custom hook won’t be fired when your settings … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)