Calling Specific Pages with wp query Part II

Two issues here The default page post type is page, not pages Your meta_query is wrong, it should be an array of an array, not just an array Your arguments should be $args = array( ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 50, ‘meta_query’ => array( array( ‘key’ => ‘field_5505a81b83234’, // field key generated … Read more

loop query exclude meta_key with meta_value

Do NOT use query_posts() – it is bad, very bad to be exact. For more information read: When should you use WP_Query vs query_posts() vs get_posts()? When to use WP_query(), query_posts() and pre_get_posts Use WP_Query instead. Example with meta_key, meta_value and meta_compare parameters in use: $args = array( ‘meta_key’ => ‘clpr_excoupon’, ‘meta_value’ => ‘0’, ‘meta_compare’ … Read more

WP_User_Query with meta_query array relation ‘OR’

From the Codex: Multiple custom user fields handling $args = array( ‘meta_query’ => array( ‘relation’ => ‘OR’, 0 => array( ‘key’ => ‘country’, ‘value’ => ‘Israel’, ‘compare’ => ‘=’ ), 1 => array( ‘key’ => ‘age’, ‘value’ => array( 20, 30 ), ‘type’ => ‘numeric’, ‘compare’ => ‘BETWEEN’ ) ) ); Try adding the 0 … Read more

Using get_terms() with meta_query parameters

Inserting boolean term meta values When we add non-existent term meta with e.g. add_term_meta( 123, ‘test’, true ); then we are actually running the following insert : $wpdb->insert( ‘wp_termmeta’, array( ‘term_id’ => 123, ‘meta_key’ => ‘test’, ‘meta_value’ => true ) ); within the general add_metadata() function. Now wpdb::insert() is actually a wrapper for wpdb::_insert_replace_helper() that … Read more

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