Where exactly does the edit_{taxonomy} hook fire?

Please have a read on how to work with filters and actions (I’m not repeating it here). The filter in a theme or plugin // inside /wp-includes/taxonomy.php on line 1586 $value = apply_filters(“edit_{$taxonomy}_{$field}”, $value, $term_id); // inside some theme file that runs before – best on functions.php during your themes bootstrap: function wpse40709_edit_tax_field( $value, $term_id … Read more

Add_filter rel=”prettyphoto” to WP3.4.1

Ok, after a few days trying various variations on the code I was originally using I still had no success. I took my theme right back to the bare bones, and tried the code again, I even tested the code of the TwentyEleven theme but still had no joy. I have an answer but not … Read more

add_filter to the_content after apply_filters

if you want to keep the current setup, try to hook in early and use do_shortcode(): function av_standalone_doc_404($content) { remove_filter( current_filter(), __FUNCTION__ ); if ( has_term( ‘standalone-document’, ‘formats’ ) ) { $filtered_content = do_shortcode( $content ); // … If you want to avoid repeating shortcode outputs use a static variable in the shortcode handler: function … Read more

Finding actual functions added to hooks and filters

This is more of PHP programming question, rather than WordPress one. 🙂 If you are interested in exploring function of WordPress core alone, there is number of ways dedicated to that: Codex has function reference that is human maintained – so it’s not comprehensive but can include additional information for important functions; xref is code … Read more

need correction with a snippet in functions.php [closed]

If it is a dropdown and you want to populate it with options may be use this filter add_filter(“gform_predefined_choices”, “add_predefined_choice”); function add_predefined_choice($choices){ $choices[“My New Choice”] = array(“Choice 1”, “Choice 2”, “Choice 3”); return $choices; } http://www.gravityhelp.com/documentation/page/Gform_predefined_choices gform_field_value_selection filter is for default value. Give a look here http://www.gravityhelp.com/documentation/page/Developer_Docs See if this works.. add_filter(“gform_field_value_selection”, “populate_selection”); function populate_selection … Read more

Adding a filter to related posts not working

$q should contain the array: add_filter( ‘woocommerce_product_related_posts’, ‘woo_custom_attribute_filter’, 10, 1 ); function woo_custom_attribute_filter( $q ) { $q = array( /* args here */ ); return $q; }

Need to return shortcode text instead of the output

Another way is to use a shortcode to display shortcodes 🙂 add_shortcode(‘SH’,’shortcode_display_handler’); function shortcode_display_handler($atts = array(),$content=null){ $content = str_replace(“[“,”[”,$content); $content = str_replace(“]”,”]”,$content); return $content; } Usage: [SH] [/SH]

Parse a shortcode differently based on on what it’s nested in

Register a new shortcode handler depending on the attribute value: function wrapper_shortcode_handler ( $atts, $content ) { if ( “apple” === $atts[“snack”] ) add_shortcode( “flavor”, “healthy_callback” ); if ( “donut” === $atts[“snack”] ) add_shortcode( “flavor”, “fatty_callback” ); return do_shortcode( $content ); } See also Execute shortcode only in another shortcode