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 plan on having over 2,000 pages per subject on my WordPress website and since each subject will require custom page types I would like to create tables for each subject in the WordPress Database. Each page will also require lat/long and alternate title's for each page created.

Can someone explain how you would go about making and using a dedicated table for each custom Page Type?

I assume that you could use an exact copy of wp_post table?

share|improve this question
1  
Why not just use the the post table? You won't be able to use separate tables for each post type and still be able to use the vast majority of the WordPress API - and as far as I can see there is no benefit in doing so.... –  Stephen Harris Sep 9 '12 at 19:18
    
I'm afraid of using one table for what will eventually be tens of thousands of pages and posts. What do you think? –  BenRacicot Sep 9 '12 at 23:36
1  
Database tables are designed to cope with millions of rows. Any slowness in the query won't be noticed against how long it takes to load images, stylesheets etc. WordPress also uses caching - so creating your own stuff will likely be slower. –  Stephen Harris Sep 9 '12 at 23:43

1 Answer 1

The requirements you've specified don't indicate any need for a custom post table. Just register a custom post type using register_post_type(), and then manipulate its entries using the standard WordPress API.

Example from the codex, registering a 'book' custom post type with a label of "Books":

function my_init() {
    $args = array( 'public' => true, 'label' => 'Books' );
    register_post_type( 'book', $args );
}
add_action( 'init', 'my_init' );

You can save your latitude, longitude and alternate title values as post meta.

share|improve this answer
    
Typically you don't fill one table up with a large handful of subjects I'm told. Won't queries by slow after say 5,000 rows of data? That's really what I'm afraid of. –  BenRacicot Sep 9 '12 at 23:25
    
Eventually complex queries will get slower as the size of your database grows, especially those involving joins: using another custom table as opposed to using the WordPress posts table won't improve that inevitability, yet your data will become less accessible to the WordPress API, which in my opinion is an overall drawback. –  Bendoh Sep 9 '12 at 23:50
    
Sigh, so it comes back to what can WordPress' database handle before I start noticing in performance? 10K? 20k? 100K posts and pages? I suppose having the post_meta table breaks it up a bit... –  BenRacicot Sep 10 '12 at 20:01
    
This depends on your server and what you are querying, if you just pulling in posts don't worry about it, it's millions. –  Wyck Feb 5 '13 at 22:13

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.