1

I have a project in which I am trying to import a large amount of data into a WordPress installation and from that data, create pages on my site (as a custom post type). Since these pages will be visited far less often than the rest of our site, we decided to keep the data separate from posts and postmeta, so that it doesn't affect load times. The information does need to create the custom posts so that they can be added to the sitemap (using google xml sitemaps - too many to add by hand).

I have created a custom post type and created the beginning of a plugin that creates a custom table in the database. My thought is that I could then create a function that saves the post information to this database rather than post or post meta when it is being created. I know enough php to get by and am new to sql, but have help to turn to if I need it. Unfortunately, they are less well versed on the wordpress side than on coding, so I would like to try to gather as much information as possible before turning to them.

So does this sound like a reasonable plan and does anyone know of resources where I could get a feel of what I would need to do?

3 Answers 3

1

If you look at wp_insert_post()'s source code, you can see that it's locked to using $wpdb->posts...so you'd really need to modify the core to make it work the way you have outlined (or potentially filter it earlier up in the loop, either way, you're making a mess). That said, having a large number of posts does not put a significant load on your site, since almost everything is done by IDs or by name directly, and rarely, if ever, by filtering from a list of returned results...you're talking like fractions of a millisecond in gains for an incredibly hacky solution. I strongly recommend that you just stick with what wordpress has by default as the structure is quite efficient as it is.

1
  • 3
    optimize elsewhere- opcode cache, varnish cache, memcached.
    – Milo
    Commented Feb 6, 2012 at 16:53
1

I advise you look into Pods framework, it will meet your needs and it's very flexible. version 2 is round the corner it allows you to extend or create post types. meta can be stored in separate table if you want.

have a play around, download from github.

i used version 1 and 2(beta) can recommend to anyone. the team behind it provide excellent support as well.

http://podsframework.org/

0

I've already faced this kind of matter, but my approach was quite different: I've created a sort of framework to do crud operation and manage totally new entities, each one different from others, using the wp db layer, supported by a custom db layer. In your case, I think is possible to do what you want but you need to use hook to intercept save post call, then check post_type and execute your own save post function to overwrite standard one in case post type was one of newly added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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