Skip Navigation

[Resolved] New custom fields pre-filled with post ids

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Puntorosso 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1954643

I would need to add a custom field to an existing CPT, which have already hundreds of posts published.
This new custom field should automatically be filled with the post ID number.

Which is the best way to bulk add the ids to the existing posts?

#1954857

There's no easy built-in way to bulk edit custom fields like this in Toolset, so I would probably try to export these posts using a CSV export tool, then duplicate the post ID column into a separate column with a header like wpcf-fieldslug, then import those posts back into the site using the update existing posts feature, and map the new duplicate column to the desired Toolset custom field. I've used WP All Import to do something similar, so you might look into that plugin or another similar CSV import/export tool.

#1955109

Yep, this was my "plan-B".
Time to make use of my WP All Import developer license.
Still, I was hoping for a simpler solution 😉
Thanks