WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to put together a site with membership functionality and i'm having most of what i need together. However, what's still missing in the mix are two things:

  1. I need to be able to display content starting from a certain date and stop displaying it starting from a certain date (or give it an expiration time).

  2. I'd like to be able to have content flagged as viewed by individual users so i can then display it in a different section of the site for that user. How that's done (if via taxonomies or whatever) i don't really care and the 'putting it somewhere else' i can do myself.

Are there any good, simple (do one thing only, but do it right), free plugins that cater for the above?

share|improve this question

there are some plugins to achieve what you are trying:

Post Expirator - Allows you to add an expiration date (minute) to posts which you can configure to either delete the post or change it to a draft.

Simple Expires - Enable Posts and Pages to automatically expire and change at a certain time, and provide notification of expiration.

as for the second part of your question,

I'd like to be able to have content flagged as viewed by individual users so i can then display it in a different section of the site for that user.

you can do that by simply adding a new usermeta field that will contain an array of post ids like so

function my_user_flag_887($post_id){
    if ( is_user_logged_in() ) {
        global $current_user;
        $user_flags = get_user_meta($current_user->ID, 'flaged', false);
        $user_flags[] = $post_id;
        update_user_meta($current_user->ID , 'flaged', $user_flags);

so all you have to do is call that function and pass the post_id to add/flag


and assuming that the user is logged in it will add the ID 43 to the users flag array.

and you can check to see if a user has flagged a post by simply checking if it in that array or even better you can use wp_query to select posts that are not in that array:

global $current_user;
        $user_flags = get_user_meta($current_user->ID, 'flaged', false);
    $my_q = new WP_Query(array('post__not_in' => $user_flags ));
    if ($my_q->have_posts()){
        while ( $my_q->have_posts() ) { $my_q->the_post();
            //do you loop stuff
    echo 'nothing found';

Hope this helps

share|improve this answer
Thanks for the reply, i'll give that a go as soon as i get around to it and the flag your comprehensive answer. – wyrfel Feb 19 '11 at 8:49
For the second part...since this might grow a bit quickly (we'll have weekly posts to be flagged), i'm wondering if i should just create my own table instead? Which one would be more performant...passing a long array to post__not_in or joining another table with a single reference id? – wyrfel Feb 19 '11 at 8:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.