0

i have created a Search template in elementor pro, i'm using Archive Posts widget to show the result. but the problem is i want to include the CPT in the result.

i tried the pre get post function, but its not working, it only shows the posts

function vikram_include_custom_post_types_in_search_results( $query ) { if ( $query->is_main_query() && $query->is_search() && ! is_admin() ) { $query->set( 'post_type', array( 'service', 'specialty' ) ); } } add_action( 'pre_get_posts', 'vikram_include_custom_post_types_in_search_results', 10, 1 );

plz guide me how to do this

thanks in advance

2
  • You'll have to ask Elementor Pro; I don't even know if their Archive Posts Widget has this capability. Commented Apr 25 at 1:28
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Apr 25 at 1:28

0

Browse other questions tagged or ask your own question.