Title: Custom fields script
Last modified: August 18, 2016

---

# Custom fields script

 *  [helton](https://wordpress.org/support/users/helton/)
 * (@helton)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-script/)
 * I’ve added a custom field named CheckThisOut. Now whenever I add a post, I always
   have something CheckThisOut for that post. The custom field is part of my template,
   so it is displayed beautifully on all posts.
 * Now, I have collected CheckThisOut ‘s for my previous posts, but it is a humongous
   task to manually edit all my previous posts for that and manually insert those!
   And I want to do that because considerable traffic is being generated by old 
   posts.
 * So, could there be an automated way, where, say, I can insert CheckThisOut custom
   fields to my old entries? I was thinking may be a script which takes a post ID
   and CheckThisOut from a text file that I’ll create (each line contains a post
   ID space and the data for CheckThisOut.
 * But I’m no programmer! 🙁 Anyone who could help me with that? Many thanks in 
   advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-script/#post-143619)
 * [http://guff.szub.net/wp-content/sourceprt.php?file=sample-23205.php](http://guff.szub.net/wp-content/sourceprt.php?file=sample-23205.php)
 * This should do. For each post you want to add CheckThisOut to, add it to the 
   $ctos array. The format, as should be obvious through the source, is:
 * `POST_ID_NUM => "VALUE OF CUSTOM FIELD",`
 * Probably a good idea to edit those currently shown in the array…
 * Name the script “addcustom.php”, upload to the directory wp-blog-header.php resides
   in, and run it (just once) from your browser.
 *  Thread Starter [helton](https://wordpress.org/support/users/helton/)
 * (@helton)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-script/#post-143734)
 * Thanks a bunch! I’m gonna give it a try 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom fields script’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [helton](https://wordpress.org/support/users/helton/)
 * Last activity: [21 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-script/#post-143734)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
