Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I recently created a new site using wordpress but I'm a rookie - everything I know is trial and error with no formal training. So please, please, please keep your answers as simple as possible. Thanks in advance.

I created custom fields and then uploaded a .csv file to create roughly 3,300 posts. I left the post_content field blank. I then developed the desired post content through the front-end using shortcodes that referenced the custom fields. Once I had what I wanted I UPDATED the poct_content field using MySQL. Every post_content for all posts is the same with the data from the custom fields being the variables. All was well to this point.

When I attempted to preview in a browser I realized the custom field data is not displaying. I found that if I open a post through WordPress front-end and then click "update" the custom field data and the post content "sync" and then it will display properly through a browser.

My concern is that I have nearly 3,300 posts and I really don;t want to "update" them all manually.

Is there a way to write a php module to do this automatically? Is there a plugin that will do this? Is there some code that can be placed in the theme to update it when a post is opened?

I am currently using the iFeature theme from cyberchimps but I'm not married to it. I'll change immediately if there as different theme that will make this work. The reason i mention the theme is this - there is no single.php file visible through wordpress but i can see it if I go to the server where the theme is saved.

Example of working page: http://gunspecs.net/zastava/zastava-m70

Non-working page: http://gunspecs.net/ruger/ruger-sr40

Thanks in advance for your help. Dennis

share|improve this question
    
Do you have access to the MySQL database? It might be worth checking to see what the post_status of the non-working posts. If they're not set to published (or publish, I forget which is the correct status), try changing that then viewing the page again. If that fixes it, it's a quick and easy SQL statement to fix the problem. –  dunc Apr 29 '12 at 17:43
    
I do have access to the database and checked the post table. All of the posts are listed as "publish". I think the underlying issue is because the post_content contains shortcodes that reference custom fields and until the post is "refreshed" the system can't associate the shortcode with the custom field value. So it displays nothing. But thank you for the suggestion. –  Dennis Apr 29 '12 at 17:55
add comment

1 Answer

Probably your already solved this (hopefully not by hand).

This part of your question is intriguing:

I found that if I open a post through WordPress front-end and then click "update" the custom field data and the post content "sync"

Do you mean back-end, right?

If so, I think a bulk update would solve this problem.
In wp-admin/edit.php

  • increase the number of post shown (Screen options)
  • select all
  • Bulk actions -> Edit
  • "change" some parameter, e.g. mark the same Author, o same Ping, or insert a temp tag you'll delete later

Maybe, before increasing the number of posts shown, do a little test to see if it works.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.