Search in custom post type
-
Hi, recently updated my wordpress to 5.5.3, before this update, i think my query work fine, but now have problem on it. I was created a custom post type like ‘my_post_type’ and wan’t search in this post type list. this is my arguments for WP_Query:
$args = [
‘post_type’ => $this->getPostTypeId(),
‘posts_per_page’ => $request->count,
‘offset’ => $request->getPaginationOffset(),
‘post_status’ => ‘publish’,
‘s’ => $request->keyword,
];When remove search (‘s’) request, the query retrieve my custom post type list, but when add the search the query search in ‘post’ post type (default post type). How can search on post that based on my custom post type?
- The topic ‘Search in custom post type’ is closed to new replies.