Use plugin function in custom WP_Query
-
Hi,
Is there a way to make a WP_Query that uses plugin shortcode?
Maybe like:
$the_query = new WP_Query(km_rpbt_related_posts_by_taxonomy( $post_id , ‘category’, $args ));
OR
$the_query = new WP_Query([related_posts_by_tax exclude_terms=”20,23,14″]);Not sure if that would work.
I saw this on your page at https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/#shortcode but that just seem to add post ID:
// example query
$the_query = new WP_Query(‘cat=3’);// add this right after the query
// use the query object ($the_query) to check if posts are found
$the_query_id = ( isset( $the_query->post->ID ) ) ? $the_query->post->ID : 0;
set_query_var( ‘km_rpbt_related_post_id’, $the_query_id );Thank you so much.
- The topic ‘Use plugin function in custom WP_Query’ is closed to new replies.