query by custom field from wp user frontend
-
Hi
How to query by custom field<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $ar = get_post_meta( $post->ID, 'oboz', true ); $args = array( 'order' => 'ASC', 'key' => $ar, 'value' => 'Letnie', 'compare' => '=', 'paged'=>$paged, 'posts_per_page' => 1, ); $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query( $args ); if ( $wp_query->have_posts() ) : ?>
Field named “oboz” is radio meta field with 2 values “Letnie” and “Zimowe”. I want to query “Letnie” so i compare this value to key “oboz” but it doesnt work… Of course query works without args – key, value, compare.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘query by custom field from wp user frontend’ is closed to new replies.