I got a custom post type called "employees" and this is the query I use with FacetWP (plugin we are using). We want to sort the employees by post_title.
<?php
return [
"post_type" => [
"employees"
],
"post_status" => [
"publish"
],
"orderby" => [
"post_title"
],
"order" => [
"ASC"
],
"posts_per_page" => "99"
];
This aint working and I tried it like this:
<?php
return array(
"post_type" => "employees",
"post_status" => "publish",
"meta_key" => "post_title",
"orderby" => "meta_value",
"order" => "ASC",
"posts_per_page" => 99
);
This gives u back nothing because the "post_title" doesnt exist in the postmeta table.
Maybe there is a very simple solution for this but I am a but lost here. How can I sort the custom post types by the post_title?
'orderby' => 'title'
?WP_Query
instead - and if you got stuck, you can come back here.