Have custom post type posttype with multiple taxonomies like tax1, tax2 and post_tag which added like this:
function add_tags_categories() {
register_taxonomy_for_object_type('post_tag', 'posttype');
}
add_action('init', 'add_tags_categories');
And now searching for any solution to get most related posts by same tags count in posts.. most likely found solution like this:
$tags = wp_get_post_terms( $post -> ID, 'post_tag', ['fields' => 'ids'] );
$args = array(
'post__not_in' => array( $post -> ID ),
'posts_per_page' => -1,
'ignore_sticky_posts' => true,
'orderby' => 'count',
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'terms' => $tags
)
)
);
$my_query = new wp_query( $args );
But its not working.. I got $tags in array with ids,
query also seems working, just not finding any similar posts... but I have created and similar, and identical with tags also.. But result is still 0 posts..