Support

Account

Home Forums General Issues SQL query for my article (custom fields)

Solving

SQL query for my article (custom fields)

  • Hello,

    I have 500 articles on my wordpress,
    and I add a new field in my ACF plugins

    I wonder if I can determine for all items the same value with a SQL query

    example is my new fields city and value for all items London

    I would define london automatically for all items,
    otherwise I have to do it article by article and take longer

    thank you very much

  • Hi @pecnet ,

    Thanks a lot for reaching out to us.

    ACF does not provide bulk update functionality at the moment.

    However you could update the post meta values for all the existing posts using the update_field function.

    Kindly have a look at this article that might be able to help.

    http://jboullion.com/update-post-acf-fields/

    Hope this helps.

  • Hello,

    I looked at your link
    but I did not understand
    or I have to put the custom fields

    And I found this query but it does not work

    INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT wp_posts.ID, 'my-custom-field', 0 FROM wp_posts WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type='hello';

    -> https://snippets.khromov.se/batch-adding-custom-field-to-posts/

    I am looking for a query that can add custom fields and make all update to post

    thanks

  • I solved the problem
    with plugins
    -> Custom Bulk / Quick Edit

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘SQL query for my article (custom fields)’ is closed to new replies.