开发者 | hijiri |
---|---|
更新时间 | 2025年9月16日 11:37 |
捐献地址: | 去捐款 |
PHP版本: | 3.5.0 及以上 |
WordPress版本: | 6.8.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
orderby=menu_order
and order=ASC
to respect the drag-and-drop order.\
To keep the default WordPress order (by date), explicitly set orderby=date
and order=DESC
.
Source code and development are available on GitHub.
/wp-content/plugins/
directory.No. After activation, items are sortable in the admin UI, and front-end queries for enabled post types are ordered by menu_order ASC
automatically—unless you explicitly pass your own orderby
.
Specify orderby=menu_order
and order=ASC
in your query args.
WP_Query:
`
'your_cpt',
'orderby' => 'menu_order',
'order' => 'ASC',
) );
?>
`
get_posts():
`
'your_cpt',
'orderby' => 'menu_order',
'order' => 'ASC',
) );
?>
`
Explicitly set: ` 'date', 'order' => 'DESC', ) ); ?> ` For get_posts(), the plugin supports a small switch: ` 'default_date', 'order' => 'DESC', ) ); ?> `
query_posts()
is discouraged by WordPress core because it alters the main query in a fragile way.\
Use pre_get_posts
(recommended) or WP_Query
instead.
Example with pre_get_posts to force date order on the main blog page:
`
is_main_query() ) {
return;
}
if ( is_home() ) {
$q->set( 'orderby', 'date' );
$q->set( 'order', 'DESC' );
}
} );
?>
`
Yes. For enabled taxonomies, terms can be reordered and are returned in that order on the front end.\ When you build custom term queries, make sure you don’t override the order unless you intend to.
Yes. When enabled in Network settings, Sites are ordered by menu_order ASC
. Drag & drop in Network Admin updates the order.
Go to the "Screen Options" tab at the top right of the list table and increase the "Number of items per page".\ This way, all items you want to reorder will appear on the same page and can be dragged to the desired position.
manage_network_options
capability and *_site_option
APIs for multisite settings.admin_url()
/ network_admin_url()
and ensure exit;
after redirects.$_GET
, $_POST
, and $_SERVER
values with strict comparisons.get_file_data()
, cleaned up pre_get_posts
return values.wp.a11y.speak
.