Support » Fixing WordPress » Add custom field with value on older posts

  • Hi all.

    I want to add automaticaly on 27.000+ posts a custom field with value. it’s possible to make it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You could run a custom SQL command on your MySQL DB to add a custom post type’s custom field to all posts, but would each be the same? What is the point?

    yes, the custom field is same for all older posts. can you tell me the command ?

    INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
    SELECT wp_posts.ID, 'Day', 'Sunday'
    FROM wp_posts
    WHERE wp_posts.post_status = 'publish' and wp_posts.post_type = 'post';

    —————-
    Day = Meta Key
    Sunday = Meta Value
    Change as per your requirement. Thanks

    thank you @deepak Rajpal!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add custom field with value on older posts’ is closed to new replies.