How to change domain used when pinging sites

Here’s what I came up with to accomplish this. I’m not naive enough to think this is the best way, but it works. Again, still interested to know if others have any better ideas. Ultimately, the reason why I needed to do this was because I use the domain mapping plugin, and I have it … Read more

Change WordPress RSS link with filter?

You can take advantage of the template_redirect hook and redirect any request to the WordPress feed to a URL that you define. The most important thing to consider is the case when users are attempting to access the feed itself. In that case, you’d obviously not want to do any redirection. Here’s how you can … Read more

Right way to add HTML bloginfo name using a filter

You can’t check the context while the filter callback is called, because the element is already in the frontend. There are 3 solutions though: 1. jQuery Search for the element and add html to the places in the name. 2. PHP in element Get the bloginfo(‘name’); in the element and change it on that place … Read more

Exclude One Category and its Subcategories using WP_LIST_FILTER

I am answering a question after like 6 months, so I expect the quality of my answer not upto WPSE standards and hence would love feedback from other experience WPSE gurus. Add the following function to your functions.php function filter_category_list_by_slug( $slug, $categories ) { $excluded_parent = get_category_by_slug( $slug ); $excluded_cats = get_categories( array( ‘child_of’ => … Read more

Nested calls the the_content filter

Single filter call Just give this plugin a try. It illustrates the whole technique. <?php /** Plugin Name: (#69351) Example single filter call on <code>’the_content'</code> */ function wpse69351_single_call( $content ) { // Only for single view request (post, page, etc.) if ( ! is_singular() ) return $content; // This removes the filter during its first … Read more

failed to filter hook `get_terms_defaults`

Filters are for modifying data that’s passed through them. You need to take the input, modify it, then return it. function exclude_not_allowed_terms( $args, $taxonomies ) { if(!current_user_can(‘edit_others_posts’) && in_array( ‘my-taxonomy’, $taxonomies ) ) { $args[‘meta_query’] = array( array( ‘key’ => ‘owner’, ‘value’ => get_current_user_id() ) ); } return $args; } add_filter( ‘get_terms_defaults’,’exclude_not_allowed_terms’, 20, 2 );

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