WordPress.org

Support

Support » Plugins and Hacks » Hacks » Add metadata to all posts/pages

Add metadata to all posts/pages

Viewing 3 replies - 1 through 3 (of 3 total)
  • Am I really the only one trying to do this?

    Hi, I don’t know where to put this question but I am encountering a problem on my site regarding add_post_meta() function. I don’t know if it is just a coincidence or what but the permalink structure of the site always reset to its original setting whenever I execute add_post_meta() programmatically to add new item. Anyone can help me regarding this add_post_meta() and permalink problem.

    Thanks in advance.

    Regarding the OP if still looking an answer after 5 months…

    Something like this will query for all your published posts:

    $args = array(
        'numberposts' => -1
    );
    
    $posts_array = get_posts( $args );

    Then you can just make a custom loop to run through each post and do whatever you want with it:

    foreach( $post_array as $post ) {
        /* Code to poke at individual posts */
    }

    Here are the relavent codex pages:

    http://codex.wordpress.org/Template_Tags/get_posts
    http://codex.wordpress.org/Class_Reference/WP_Query

    @telepisodes:
    It would be better to start a new topic since that really doesn’t have much to do with the original question asked. For a question like that, I would ask in the How-To and Troubleshooting forum.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add metadata to all posts/pages’ is closed to new replies.
Skip to toolbar