Hi @christer_f,
Are you referring to the order of a page within a folder when using the legacy folder browser?
If so, the order is in fact stored in the postmeta table like you guessed and the meta key is constructed using this pattern:
_wicked_folder_order__{folder_taxonomy_name}__{folder_id}
The taxonomy name for page folders is wf_page_folders
. So, assuming you have a page folder with an ID of 1
, the meta key would be:
_wicked_folder_order__wf_page_folders__1
That being said, you can easily query pages by their folder-based sort order by setting the orderby
parameter to wicked_folder_order
. For example, to get all pages in folder 1
ordered by their sort order within the folder, you could do something like this:
$pages = get_posts( array(
'post_type' => 'page',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'wicked_folder_order',
'tax_query' => array(
array(
'taxonomy' => 'wf_page_folders',
'field' => 'term_id',
'terms' => 1,
'include_children' => false,
),
),
) );
Note that wicked_folder_order
only works when you include a tax_query that filters by a single folder since the order is specific to a single folder.
I hope this helps! Let us know if you have questions.
-
This reply was modified 6 years, 1 month ago by
wickedplugins. Reason: Corrected example meta key