Advanced Category Excluder (ACE) plugin for WordPress

by

·

For a couple of days I was looking for a plugin for my blog, that can hide some categories, form the front page. After I discovered, that I need to hide them as well from the RSS feeds. And after I’ve figured out that what I want a plugin that I can control categories to be displayed or hidden, in different parts of the blog.

For example I’m planning to write technical articles in english. But I’m writing my blog in hungarian… And maybe most of people who are reading my blog won’t be interested in such technical subject, but those who are using my blog’s RSS feed maybe interested in technical articles.

So I’ve written a plugin for WordPress that can solve the problem mentioned above.
This plugin was written from scratch, but it has been inspired by Front Page Excluded Categories Plugin by Sean O’steen and Jason York.

Download here(1 Kbyte ZIP)

Details:

  • controls which category would appear in which part
  • handles empty categories
  • hides BlogRoll from category list
  • support for Event Calendar
  • works with WordPress 2.1, 2.2 and 2.3

Comments

44 hozzászólás a(z) “Advanced Category Excluder (ACE) plugin for WordPress” bejegyzéshez

  1. Advanced Category Excluder (ACE) plugin for WordPress…

    For a couple of days I was looking for a plugin for my blog, that can hide some categories, form the front page. After I discovered, that I need to hide them as well from the RSS feedsl. And after I’ve figured out that what I want a plugin that I can…

  2. Harder avatar

    Alapból 2 külön blogra kéne tenni a tartalmat. 😛 A személyes és a technikai tartalmat – ha ez többször is elő fog fordulni, főleg eltérő nyelveken – nincs értelme összekeverni.

  3. DjZoNe avatar

    Ez nem látszik a főoldalon. De RSSben bent hagytam.

  4. Nice from Thailand (SE7ENize.com) avatar

    This is what I’m looking for! Thanks for great plugin. 😀

  5. New To this avatar
    New To this

    I’m pretty new to WordPress but this exactly wha tI am looking for. I have installed the plugin – and activted it- but I can’t see where in the dashboard that this plugin appears – where is that?

  6. lila avatar

    Thanks for this plugin. It was what I was looking for!
    for those that are looking from where to set up this plugin, I’d suggest to have a look under Options- ACE!
    Regards

  7. Dave avatar
    Dave

    Dude, brilliant! This is just what I was looking for to make my WordPress site work the way I wanted. Thank you.

  8. jameswillisisthebest avatar
    jameswillisisthebest

    This is my first post
    just saying HI

  9. memoxxxx avatar
    memoxxxx

    Hi! excellent plugin! but, i get this message when I try to use it on my blog:

    WordPress database error: [Not unique table/alias: ‘wp_post2cat’]
    SELECT SQL_CALC_FOUND_ROWS distinct wp_posts.* FROM wp_posts LEFT JOIN
    wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN
    wp_categories ON (wp_post2cat.category_id = wp_categories.cat_ID) LEFT
    JOIN wp_post2cat ON wp_post2cat.post_id = wp_posts.ID WHERE 1=1 AND
    category_id IN (3) AND (post_type = ‘post’ AND (post_status =
    ‘publish’ OR post_status = ‘private’)) AND wp_post2cat.category_id NOT
    IN (18) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 1

    🙁 Can you help me?

    Thanks in advance.

  10. Alex avatar

    Nice plagin:-)

  11. DjZoNe avatar

    memoxxxx, it has been fixed in version 1.0.1.
    Thank you for you, and other reporters 🙂

  12. Faro Viejo avatar

    I upgrade my blog to wordpress 2.3, but this plugin (version 1.0.2) dont´work 🙁

    how would i can fix this problem ?

    Thanxs

  13. Rirath avatar

    1.0.2 indeed seems to be not functioning correctly on 2.3. Seems to have no effect at all.

  14. DjZoNe avatar

    If you give a detailed bug report I’ll see what can I do about it.
    My blog is running under WP 2.3 and works perfectly for me.

  15. Sean O'Steen avatar

    I think I have the fix for your plugin. On Line 41, the WHERE clause compares wp_term_relationships.term_taxonomy_id to your list of categories when it should probably be comparing the wp_term_taxonomy.term_id field.

    Thanks,
    Sean

  16. Sean O'Steen avatar

    Hmmm, maybe not. It worked in the ‘front page excluded categories’ plugin. I’ll need to get my head wrapped around the control panel code and the ‘get_categories’ function.

  17. Jim Hinds avatar
    Jim Hinds

    Sean is on the right track. The category numerical equivalents are in the wp_term_taxonomy.term_id field. That table must be part of the MYSQL request as well as the category rejection criterion.

    The category numerical equivalent and taxonomy equvalence table is wp_term_taxonomy. You cannot just look them up in the wp_term_relationships table.

    Looks like we are back in debug mode for a few days.

  18. […] DjZoNe blogol » Archívum » Advanced Category Excluder (ACE) plugin for WordPress A very nice and clean plugin, which borrowed my code and then added a whole gui control panel for it. Very nice. Waiting for WP 2.3 fixes before I test further. (tags: wordpress) by delicious Wednesday September 26, 2007 4:33 pm […]

  19. ~Karolis avatar

    Looks like a very useful plugin, but it doesn’t work on WP 2.3 for me 🙁 Hope you can figure out why. If I can be of any help – just let me know.

  20. DjZoNe avatar

    Thank you Faro,Rirath, Sean, Jim and Karolis for your reports.
    The new version 1.0.3 is out. It’s available from wordpress.org 🙂

  21. Jim Hinds avatar

    I think I have figured out why the category is excluded sometimes and not others. It is because the SQL query selects for posts with tags OTHER than the ones you wish to exclude. So, if a posting has several tags, it WILL be picked up even though it is in the category you wish to exclude.

    For example (my category for exclusion is 15, and I hand crafted a mySQL query that returns the proper results — the query uses the mysterious ‘NOT EXISTS’ clause:

    SELECT SQL_CALC_FOUND_ROWS distinct wp_posts.* FROM wp_posts WHERE 1=1 AND post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’) AND NOT EXISTS (SELECT * FROM wp_term_relationships JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id WHERE wp_term_relationships.object_id = wp_posts.ID AND wp_term_taxonomy.term_id IN (15) ) ORDER BY post_date DESC LIMIT 0, 6

  22. Jim Hinds avatar

    I have changed the two routines ace_join and ace_where to the following code fragment with good results. These changes are not useful for earlier versions of wordpress. And may be entirely incorrect, but for me, right now, these seem to be what is needed.

    function ace_where($where) {
    global $wpdb, $wp_query, $targets;

    if (is_array($targets))
    {
    foreach ($targets as $key=>$val)
    {
    if ($wp_query->$key == 1) $filter = $key;

    }
    }

    $cats_to_exclude = get_option("ace_categories_".$filter);

    if ( !empty($filter) && strlen($cats_to_exclude) > 0)
    {
    if (empty($wpdb->term_relationships)) $where .= " AND $wpdb->post2cat.category_id NOT IN (" . $cats_to_exclude . ")";
    else {
    //$where .= " AND $wpdb->term_relationships.term_taxonomy_id NOT IN (" . $cats_to_exclude . ")";
    $where .= " AND NOT EXISTS (";
    $where .= "SELECT * FROM wp_term_relationships JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id ";
    $where .= "WHERE wp_term_relationships.object_id = wp_posts.ID AND wp_term_taxonomy.term_id IN (" . $cats_to_exclude . ") )";
    }
    }

    return $where;
    }

    function ace_join($join) {
    global $wpdb, $wp_query, $targets;

    if (is_array($targets))
    {
    foreach ($targets as $key=>$val)
    {
    if ($wp_query->$key == 1) $filter = $key;

    }
    $cats_to_exclude = get_option("ace_categories_".$filter);
    }

    if ( !empty($filter) && strlen($cats_to_exclude) > 0)
    {
    if (empty($wpdb->term_relationships))
    {
    if (!preg_match("/post2cat/i",$join)) $join .= " LEFT JOIN $wpdb->post2cat ON $wpdb->post2cat.post_id = $wpdb->posts.ID";
    }
    else
    {
    // if (!preg_match("/$wpdb->term_relationships/i",$join)) $join .=" LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) ";
    // if (!preg_match("/$wpdb->term_taxonomy/i",$join)) $join .=" LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id";
    }
    }

    return $join;
    }

  23. DjZoNe avatar

    Jim, thank you for you contribution.

    By the way, does the version (1.0.3) solved the problem, doesn’t it?

  24. David T. avatar
    David T.

    I have installed this plugin on my blog running WP 2.3 and discovered an issue with it. When this plugin is activated on my blog it breaks the tag archive. For example if you were to try and go to http://yoursite.com/tag/foo/ while this plugin in activated, it results in a 404 error. However, as soon as I deactivate this plugin, the tag archive works fine if you go to the page http://yoursite.com/tag/foo. I like how this plugin was fixing my solution of needing to hide a category. The former plugin that I was using is no longer being developed and maintained so it broke with WP 2.3. I hope that we can get this issue resolved because I really would like to use the functionality that this plugin will allow.

  25. Jim Hinds avatar

    Yup 1.0.3. Does the job!

    Good coding.

  26. Radu Capan avatar

    The same problem as David T. When plugin is activated, the tag archive is not working (404 error). When is not activated, all fine.

  27. CandyShopGirl avatar

    Hail!

    What do you think about Tokio Hotel? >:)

  28. Kristin avatar
    Kristin

    Great plugin.
    QUESTION: Can I add a page to the five in my admin from which i can exclude posts??
    Thanks!

  29. What’s going on?…

    Yesterday I’ve released Advanced Category Excluder v1.0.4, but during the afternoon I had some error reports, that it does not work with MySQL 4.0 database server family.
    So I’ve created a version called v1.0.5 and available from here.
    Reme…

  30. […] ho provato questo plugin: Advanced Category Excluder (ACE) , ma non funzionava con mysql […]

  31. Deb avatar
    Deb

    The plugin works perfectly for me on WP2.3. However I miss one feature from the plugin I was previously using (Category Visibility), and that is the ability to prevent the names of certain categories from being included in the list in the sidebar. Is it possible to add this function?

  32. DjZoNe avatar

    Hi Deb.
    This feature is available in the developement version on wordpress.org.
    Try it if you want to.
    It will be released in a week or so as version v1.1.

  33. […] バージョンアップする前に、新しく次のプラグインがリリースされたわけです! Advanced Category Excluder (ACE) plugin for WordPress | DjZoNe blogol […]

  34. […] Advanced Category Excluder (ACE) plugin for WordPress | DjZoNe blogolから最新版をダウンロード […]

  35. Gowtham avatar

    You rock!!!
    Just the right plug-in i was looking for!!
    ROCK ON

  36. […] The plugin can also be found on the author’s site. […]