Too many actions/filters!

Take a look at Mike’s answer to a similar question more specifically the plugin he posted there can be used to create a list of all action hooks and filters that were called to generate that page in order of execution.

wp_ajax action is not running

Where are you calling add_action()? If it’s in a place where you’re already outputting HTML, it’s too late, and that’s probably a place that wont even be looked at during an AJAX request. You should include that code in your theme’s functions.php file, or as early as possible in a plugin.

What hook should be used to programmatically create a post only when master post is updated?

you can use pre_post_update action hook like so: add_action(‘pre_post_update’,’post_updating_callback’); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if ($post->post_status == “publish”){ //do update stuff … Read more

Hooking new functions to actions + passing parameters

For this example lets say we have the following do_action(‘bt_custom_action’, get_the_ID(), get_the_title(), get_the_content()); The arguments that will be passed to add_action would be in this order the post id the post title the post content By default if we hook into our do_action without any arguments, like this add_action(‘bt_custom_action’, ‘bt_callback_func’); Our call back function “gets” … Read more

Use latest jQuery in WordPress (admin interface)

Starting with version 3.6 WordPress actively discourages from deregistering “critical” scripts in admin at all. For posed scope (loading newer jQuery in specific part of admin) it would make more sense to load custom copy of jQuery normally and use noConflict() on it right away to isolate it in own variable to be used in … Read more

How to pass arguments to add_action() [duplicate]

The parameter needs to be passed to the callback function in the wp_schedule_single_event function, not the add_action function. Try this: add_action(‘z_purge_products_cache’, array($this, ‘purge_products_cache’)); Then schedule the event, putting the parameter in an array: wp_schedule_single_event(time() + 20, ‘z_purge_products_cache’, array($asins_r)); Your purge_products_cache function will be called with parameter $asins_r.

How can I add a fifth option to the alignment picker?

You mentioned using the class in your comment. You could try just adding max-width:100% to the css from the link you provided. Or use jQuery: $(document).ready(function(){ $(‘img.fulljust’).each(function(){ if($(this).width() > 300){ $(this).css({ ‘width’ : ‘100vw’; ‘position’: ‘relative’; ‘left’: ‘50%’; ‘right’: ‘50%’; ‘margin-left’: ‘-50vw’; ‘margin-right’: ‘-50vw’; }); } }); }); EDIT: I realized I didn’t answer your … Read more

how to create endpoint for downloading pdf files?

A good action to hook in would be template_redirect. There you can query for your endpoint like this: add_action(‘template_redirect’, function() { global $wp_query; // Not your endpoint and not a page/post, we do nothing. if (!isset( $wp_query->query_vars[‘download’]) || ! is_singular()) { return; } // Here goes your magic! […] // And probably a good idea … Read more

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