Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?

The Problem I think there’s a typo in there: The name of the filter is posts_fields not post_fields. That could explain why the title2 field is unknown, because it’s definition isn’t added to the generated SQL string. Alternative – Single filter We can rewrite it to use only a single filter: add_filter( ‘posts_orderby’, function( $orderby, … Read more

Custom post type – order field

When declaring your custom post type using the register_post_type function, you have to add ‘page-attributes’ to the support field, like in the following example: register_post_type(‘myposttype’, array( ‘supports’ => array(‘title’, ‘editor’, ‘page-attributes’), ‘hierarchical’ => false )); You’ll need to add any other supported meta boxes as well to the ‘supports’ field, see https://developer.wordpress.org/reference/functions/register_post_type/ for more information … Read more