Allowing specific users to only add posts using certain custom taxomy terms

First hook the save_post action: http://codex.wordpress.org/Plugin_API/Action_Reference/save_post Then check capabilities: You have docs on that right? Then get_the_terms for the $post_id provided by save_post and the taxonomy you want to check. http://codex.wordpress.org/Function_Reference/get_the_terms Then if they are using a term (see note below) they are not allowed to use either stop/delete the post, set a warning, or … Read more

pre_get_posts with tax_query causes empty result

You use tax_query incorrectly. Take a look at Codex Page tax_query should be an array which can contain: relation – it should be string (AND/OR) taxonomy term – array with defined taxonomy, field, terms, and so on. In your code your setting tax_query to: $taxquery = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ … Read more

Get second level terms of custom taxonomy

You can use PHP’s array_filter to process the results of a taxonomy query function that returns its results, and then display them. Something like: # This returns the whole taxonomy… $whole_tax = get_terms(‘customtax’, array(‘hide_empty’ => 0)); $second_level = array_filter($whole_tax, function ($t) { # This term has a parent, but its parent does not. return $t->parent … Read more

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