WordPress.org

Forums

Strictly Auto Tags
[resolved] Block SAT from certain Custom post type (4 posts)

  1. RiseOfLex88
    Member
    Posted 2 years ago #

    Hi,

    I've been using the SAT plugin for the last 2 months and it's been fantastic. Great job guys!

    However, after updating to latest version of plugin (not sure if that's related) it's now doing an auto tag on my Custom post types. Is there a way of disabling this as these CPT's have hand picked tags.

    Cheers for any help

    Alex

    http://wordpress.org/extend/plugins/strictly-autotags/

  2. RiseOfLex88
    Member
    Posted 2 years ago #

    Not found a solution to this and it's now steadily tearing my site apart. I'm going to look in the plugin and see if I can do it manually rather than wait for it to be developed.

  3. RiseOfLex88
    Member
    Posted 2 years ago #

    Ok so the temporary solution I've added ( I don't recommend changing plugins unless you're happy to manually fix them for each upgrade ) a short line to the file: strictlyautotags.class.php

    on line 424
    change:

    // Add tags to posts
    wp_set_object_terms( $object->ID, $posttags, 'post_tag', true );

    to

    $type = get_post_type($object->ID);
    
    if($type == 'post') :
    // Add tags to posts
    wp_set_object_terms( $object->ID, $posttags, 'post_tag', true );
    endif;

    Not nice and only temporary but hopefully will tide things over till a proper fix is introduced. Seems like a very shaky update to include all post types but without an admin for it.

  4. Strictly Software
    Member
    Plugin Author

    Posted 2 years ago #

    I kept getting asked by people if I could modify the code so that it would tag custom post types.

    Therefore I just removed any WHERE clauses in SQL that was saying WHERE posttype='post' to post_type NOT IN('page', 'attachment', 'revision')

    Therefore it now handles custom post types.

    You can change it back by just changing the SQL back to the old way of doing things if you want.

    If I was getting any money out of doing any of this I would spend more time making it more customisable etc but I don't so you will need to hack it about to meet your open source needs.

    Here are the two ways

    // old way
    $sql = "SELECT id
    	FROM {$wpdb->posts}
    	WHERE post_password='' AND post_status='publish' AND post_type = 'post'
    	ORDER BY post_modified_gmt DESC;";
    
    // handle custom post types by allowing everything that isn't a page, attachment or revision
    $sql = "SELECT id
    	FROM {$wpdb->posts}
    	WHERE post_password='' AND post_status='publish' AND post_type NOT IN('page', 'attachment', 'revision')
    	ORDER BY post_modified_gmt DESC;";

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Strictly Auto Tags
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.