Celebrity face detection

  • Hello,

    I have problem with celebrity face detection.

    I post photo post with just one image, image is correctly uploaded to Media Library and Amazon S3, celebrity name is correctly detected (new category is created) but this category is not added to coresponding post.

    So I have 151 empty categories created, but with no posts in them.

    Please help.

  • @Michal-Rudolf

    I am testing this today and will get back to you shortly.

  • Thank you, please also check option to batch process existing posts (or images) and add these posts to corresponding categories.


  • @Michal-Rudolf

    This isn't really a Media Cloud issue per se, it's how WordPress sort of works with regards to Attachments. However, I've added a fix to the next release, but you'll need to enable it in Vision settings. It's called "Force Term Count".

    So there are actually two issues with your problem.

    By default, WordPress won't count an attachment in a term if it's not attached to anything. I've added the fix for that like I've mentioned.

    However, on Category archive pages, like yoursite.com/categories/margot-robbie attachments are not typically included. You would need to add some code to your theme's functions.php to get it working:

    add_action('parse_query', 'hijack_query');
    function hijack_query() {
    	global $wp_query;
    	// When inside a custom taxonomy archive include attachments
    	if (is_category()) {
    		$wp_query->query_vars['post_type'] =  ['attachment', 'post'];
    		$wp_query->query_vars['post_status'] =  ['publish', 'inherit'];
    		return $wp_query;

    But, it might be the case that you already have that working via another plugin or something. If that's the case then ignore the above.

    The new release should be out tonight (my time).

  • @jong Thank you, I have upgraded and tested this and it is working.

    Do you please have any idea how I can add also the corresponding post to correct category (not just the uploaded file), so there will be option to show directly posts in category archive and not uploaded media.

    Thank you

Log in to reply