how to create a proper query for getting a list of users with taxonomy related meta key

Objective I want to list sp_provider (hospital,clinics,doctors) whose sub_category is suppose ‘neurology’ rephrasing the words: I want to list users with sp provider category(meta value) such as “hospital” and the user have a sub category(meta value) “neurology” sp_provider is a meta value in user profile (sp-provider maybe a post-type or something for user management screen … Read more

How to exlude posts that have certain meta_value?

WordPress 3.5 and up supports EXISTS and NOT EXISTS comparison operators. compare (string) – Operator to test. Possible values are ‘=’, ‘!=’, ‘>’, ‘>=’, ‘<‘, ‘<=’, ‘LIKE’, ‘NOT LIKE’, ‘IN’, ‘NOT IN’, ‘BETWEEN’, ‘NOT BETWEEN’, ‘EXISTS’ (only in WP >= 3.5), and ‘NOT EXISTS’ (also only in WP >= 3.5). Default value is ‘=’. http://codex.wordpress.org/Class_Reference/WP_Query … Read more

Custom query variable – get wordpress to redirect to nice permalink url

I figured out a solution myself. No javascript required, only another template function. URL building done manually. The idea is to use the hook ‘template_redirect’, check if the requested page is the corresponding store archive page, then check for $_REQUEST vars there and build a new URL. Finally redirect to this URL. function my_template_redirect() { … 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 );