Tag Info

Hot answers tagged

3

For the media library you can use the pre_get_posts hook targeting upload.php by means of $pagenow, a global variable, or even better, because globals are the devils child, by means of get_current_screen(). I'm assuming you want to target the media modal tab too - because targeting only one, but not the other, doesn't make much sense after all -, you can do ...


2

get_the_content do not apply the_content filter. You have to apply it after receiving contents like following <?php apply_filters('the_content',get_the_content( $more_link_text, $stripteaser, $more_file )) ?> It is also detailed at the bottom of codex page


2

You can use the set_user_role hook, that will only fire when the user role changes: add_action( 'set_user_role', function( $user_id, $role, $old_roles ) { // Your code ... }, 10, 3 ); If you want to restrict this to a profile update, you can use: add_action( 'set_user_role', function( $user_id ) { add_action( 'profile_update', function( ...


1

This will definitly remove word category . Add this code in functions.php.As you already know woocommerce_template_single_meta is the hook responsible for meta information of the single-product. File is present in /woocommerce/templates/single-product/meta.php. Either you can use the following code to edit the html of meta.php or you can copy the file ...


1

The earliest hook accessible from external code is muplugins_loaded. In order to use it, create a directory mu-plugins in your wp-content directory and put a PHP file into that directory. Sample code, will have side effects(!): add_action( 'muplugins_loaded', function() { print current_filter(); }); This is, of course, not "before anything else in ...


1

Does anyone know why this 'comment_post' hook doesn't seem to work!? ... When a comment is posted, the function is not triggered... at all? The hook works. Try the following, it works: add_action( 'comment_post', 'test_notify' ); function test_notify($args , $args2) { echo 'It works!'; die; } As does this: add_action( 'comment_post', ...


1

Yes, there is a filter for this. The correct filter is wp_mail and is defined in /wp-includes/pluggable.php Line 135 So the code (maybe in your functions.php) should look something like this: function mail_template($args){ ob_start(); require_once (get_template_directory() . '/mail-templates/contacemail.php'); $args['message'] = ...


1

Ok figured it out. In the specific form settings, go to the additional fields tab. Type in the following: on_sent_ok: "location.replace('http://www.website-redirect.com');" It's working like a charm for me now. Hope this helps other developers in the future as well. I know the image is in Dutch ... but you can't miss it with the big red lines around the ...



Only top voted, non community-wiki answers of a minimum length are eligible