Support » Plugins » the_posts hook problem

  • I can’t get this plugin working. The main object of this plugin is to block guests from viewing any post in a set category via plugin file. I’ve set category number as 1. This is my first plugin, so don’t yell at me!

    Plugin Comments removed for posting on

    $my_cat = “1”;

    function applysubbyposts($the_posts) {
    global $wpdb;
    if(!is_user_logged_in()) {
    foreach($the_posts as $key => $post) {
    $thiscat = $wpdb->get_var(“SELECT category_id FROM post2cat WHERE post_id=’$post->ID'”);
    if(floatval($thiscat) == floatval($my_cat)) unset($the_posts[$key]);
    return $the_posts;
    add_filter(“the_posts”, “applysubbyposts”);

  • The topic ‘the_posts hook problem’ is closed to new replies.