Tag Info

New answers tagged

1

have a look this plugin Simply Show Hooks which will show you where all the action and filter hooks are, inline, in order, on the page you're looking at, and all the actions or filter functions that have been hooked to them. You can see in the screenshot how it does it. It does just what you've asked.


1

Try using the filter hook: function user1462_login_redirect( $redirect_to, $request, $user ) { global $user; if ( isset( $user->roles ) && is_array( $user->roles ) ) { if ( in_array( 'administrator', $user->roles ) ) { return $redirect_to . '?message=hiadmin'; } else { return home_url(); ...


1

Use the use keyword: $title = $instance['title']; add_action( 'wp_footer', function() use ( $title ) { echo $title; });


0

To add to Ahmad's answer you could just remove all html comments with the same amount of code, since Yoast isn't the only plugin that does that. <?php function remove_html_comments_buffer_callback($buffer) { $buffer = preg_replace('/<!--[^\[\>\<](.|\s)*?-->/', '', $buffer); return $buffer; } function ...


2

WordPress puts your actions into an array with an indexed priorities. You can see this by printing out ( in the admin panel admin_init ) $wp_filter: *Note* as @s_ha_dum points out in the comments below, admin_init may not catch all added hooks into the action, the more reliable print out may be hooking into shutdown instead. function filter_print() { ...


2

range of priority values? range of priority values? Generally, speaking, you can't know a priori what priority something is hooked with. The priority needed depends on how other callbacks where hooked in. Often that is the default value of 10 but it could be anywhere between 1 and PHP_INT_MAX and there is no way to be sure except by experiment and, if ...


1

If you check the source for admin-ajax.php you will notice that the admin_init hook fires and that the system checks $_REQUEST['action'] for hooks. Given that, you could hook to admin_init, check the "request" super global, construct wp_ajax_* and wp_ajax_nopriv_* values, then use has_action() to see if anything is hooked in.


0

The correct method for generating a payment URL is: get_checkout_payment_url() So my code changed to to: $payment_page = $order->get_checkout_payment_url(); Which generates the following URL: http://www.example.co.za/checkout/order-pay/[order-number]?pay_for_order=true&key=order_[order-key] Which is what I was looking for. Note that the ...


0

Have you tried to check/combine it with a wp_next_scheduled existance/work of your hook?


0

In a WordPress footer hooks are different for back-end(dashboard) and front-end. In Dashboard use "admin_footer" hook. In Front-end use "wp_footer" hook.


0

With such a general function name like method() a collision could be happening. Try something a little more unique than that. Also, if you have access to the server you could also print it to the error log so you don't have to worry when the page is being rendered.


1

Use this instead: Concatenate the html then return it. function check_my_login( $atts) { $html = '<form action="" name="" method="post" enctype="multipart/form-data">'; $html .= '<div class="form-group">'; $html .= '<label for="description">Project Description</label>'; $html .= '<textarea name="p_description" ...


0

Your best fix would be now to use switch_theme hook and filter the passed '$theme' argument to see if it is the current them then if not return; function nw_update_network($theme) { if ($theme !== 'my_theme_name') return; // Your code here } add_action('switch_theme', 'nw_update_network');


-1

You should wrap your function in parent theme like this, not in child theme function.php if (!function_exists('TaskerDev_get_first_post_image_fnc') ){ function TaskerDev_get_first_post_image_fnc($pid, $w = 100, $h = 100) { //Parent theme code here } }



Top 50 recent answers are included