Why is my nested ‘OR’ meta_query not working?

Just a couple of minor formatting changes: an extra nested array that can be deleted, and the incorrect ‘value’ when using the ‘=’ compare operator, and an unnecessary ‘relation’ parameter. $args[‘meta_query’] = array( // array( <- an extra array you don’t need ‘relation’ => ‘OR’, array( ‘relation’ => ‘AND’, array( ‘key’ => ‘dummy’, ‘value’ => … Read more

When to use WP_query(), query_posts() and pre_get_posts

You are right to say: Never use query_posts anymore pre_get_posts pre_get_posts is a filter, for altering any query. It is most often used to alter only the ‘main query’: add_action(‘pre_get_posts’,’wpse50761_alter_query’); function wpse50761_alter_query($query){ if( $query->is_main_query() ){ //Do something to main query } } (I would also check that is_admin() returns false – though this may be … Read more

why same category base and single post base don’t work?

When you set WordPress up with: The set-up Custom Permalink Structure: /blog/%postname%/ Category base: blog Generated rewrite rules WordPress generates these rewrite rules: blog/([^/]+)(?:/([0-9]+))?/?$ => index.php?name=$matches[1]&page=$matches[2] blog/(.+?)/?$ => index.php?category_name=$matches[1] Rewrite rule position in the rewrite_rules_array Your post rewrite rule (#1) is positioned earlier (therefore higher priority) than the category rewrite rule (#2) in your rewrite_rules_array. … Read more

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