• natostanco

    (@natostanco)


    I am trying to add a category to posts with more than X views. I tried adding this

    if ( $count > 3){
    			if ( has_category('rising', $post->ID) ){
    			wp_remove_object_terms( $post->ID, 'rising', 'category' );
    		}
    			wp_set_post_categories( $post->ID, 'popular', $append );
    		} else {
    			if( $count > 1){
    				wp_set_post_categories( $post->ID, 'rising', $append );
    			}
    		}

    Into the save_postview_data function but does not work

    https://wordpress.org/plugins/better-postviews/

The topic ‘adding cat to post with views > x’ is closed to new replies.