Hot answers tagged

2

I think, there are two things to be resolved: 1) You need that posts (and other post types) also followed that command, so use both: add_filter( 'post_link', 'remove_parent_category', 10, 3 ); add_filter( 'post_type_link', 'remove_parent_category', 10, 3 ); 2) but then categories also need to have changed url, so use: add_filter( 'category_link', '...


1

Thanks Lucas! I found this code as an example in several places ... still interesting that the && doesn't work ... but this does :) add_filter( 'term_link', 'slick_term_to_page', 10, 3 ); function slick_term_to_page( $url, $term, $taxonomy ) { if ( $term->term_id != 42 ) : // if ( $taxonomy != 'highlight' && $...


1

To add a filter of a class's method you must use an array in the callback like this: add_filter( 'woocommerce_credit_card_form_fields', array( $this, 'ggowl_auth_creditform' ), 10, 1 );. Of course that method must be public and either static, or the object must be instantiated.


1

The problem is that you use apply_filters incorrectly. This function takes at least two parameters: $tag (string) (Required) The name of the filter hook $value (mixed) (Required) The value on which the filters hooked to $tag are applied on. So the first param should be the name of the hook and as second param you should always pass the value of filter. If ...


1

It turns out the cause of this lingering filter problem was to do with the way WordPress was set up as well as the argument of WP_Query. Once I changed the Your Homepage Displays setting to the latest posts and renamed front-page.php to be index.php, the filter began working and the blank page no longer showed. Concerning the post filter, declaring the ...


1

First of all if you are already checking if the field is empty with that function, there's no need to use * in the backoffice [email* your-email]. In any case, it's not working because is_required()executes first than your function. Solutions: 1) Remove the * in the backend OR 2) Change the priority // From 20 to 5 should work // You only need to ...


1

Yes, you can. WP_Widget_Tag_Cloud widget uses wp_tag_cloud to generate the tag cloud. And inside that function and at the end of that function you can find this: /** * Filters the tag cloud output. * * @since 2.3.0 * * @param string $return HTML output of the tag cloud. * @param array $args An array of tag cloud arguments. */ $return = ...


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