lp__term_menu_order

lp__term_menu_order is a custom query parameter in the Launchpad plugin that allows ordering posts based on term associations within a specific taxonomy.


Product


How it Works

When querying posts, WordPress allows ordering by post meta but does not natively support ordering by term meta within a taxonomy. lp__term_menu_order extends WordPress query capabilities by modifying the JOIN clause to include term relationships, taxonomy, and term meta.

This enables ordering posts based on the menu_order meta key of their associated terms within a specified taxonomy. If no menu_order is set for a term, a default value of 9999 is used to ensure consistent ordering.


Accepted Values

  • taxonomy (string) – The taxonomy whose terms determine the post ordering.

Usage

When included in a query, lp__term_menu_order modifies the JOIN clause to connect the posts table with term relationships, taxonomy, and term meta. This allows ordering posts based on the menu order of their associated terms.


Example

$args = array(
    'post_type' => 'rep_employee',
    'lp__term_menu_order' => 'rep_employee_cat', // Replace with your actual taxonomy.
    'orderby' => 'lp__term_menu_order',
    'order' => 'ASC',
);

$query = new WP_Query( $args );

In this example, the query:

  • Orders rep_employee posts based on the menu_order value associated with terms in the rep_employee_cat taxonomy.
  • Defaults to 9999 if no menu_order value is found for a term.

Result

This query retrieves posts associated with terms in the specified taxonomy while applying ordering based on term menu order. This is useful for cases where terms influence how posts should be displayed.
Please note that the example is for reference only and may need adjustments depending on the structure of your code.

Related

Use to filter posts based on their proximity to a specific geographic location.

Use to determine the meta key by which you want to order your query results

Use to define an array of meta query conditions, including custom field keys, values, comparison operators, and data types.

Use to specify whether certain posts should be considered “featured” or not in query results.

Use to control the visibility of posts in your queries.

Use to filter posts based on various criteria.