Why my ordered query doesn't work?
-
This is my query:
$query = new WP_Query( array( 'post_type' => 'portfolio', 'connected_type' => 'portfolio_to_page', 'connected_direction' => 'to', 'connected_items' => $id, 'suppress_filters' => false, 'nopaging' => true, 'connected_orderby' => 'data', 'connected_order' => 'desc', 'connected_order_num' => true, ) );
Everthing works correctly, but the posts aren’t ordered.
data
is a meta created with the meta box plugin. Here’s the code used to create the field:function register_portfolio_meta_boxes() { $prefix = ''; new RW_Meta_Box(array( 'title' => 'Scheda tecnica', 'desc' => 'Dettagli tecnici del lavoro svolto', 'pages' => array( 'portfolio' ), 'fields' => array( array( 'name' => 'Data di completamento (MM/AAAA)', 'id' => $prefix.'data', 'type' => 'date' ), ... ) )); } add_action('admin_init', 'register_portfolio_meta_boxes');
As you can see I didn’t set any
prefix
, but I don’t think it is the problem because I can easly render the field in the theme files (get_post_meta($post->ID, 'data', true)
)
- The topic ‘Why my ordered query doesn't work?’ is closed to new replies.