Why term_id is not indexed in wp_term_taxonomy table?

A single term can, theoretically, be present in multiple taxonomies (and have a different description in each). That’s where term_taxonomy_id comes into play, referencing a single term within a single taxonomy. In practice, WP tries to avoid that, and will create a term with the same name and a -2 (iirc) suffix on the slug … Read more

store simple data in get_option()

To recap the comment chain above: I think that’s a perfectly valid way of storing some options in the database, however, it’s good practice to prepend your option name with some unique characters pertaining to your site or something, like ‘my_simple_links’ to avoid possible collisions with other plugins and themes that add_options. Also, if you’re … Read more

Organizing WP Pages based on old website database

Before getting into Importing, I would familiarize yourself with both the standard post type and post_meta as well as custom post types and taxonomies. If your end goal would benefit from the latter, you will save yourself quite a bit of headache utilizing them during the import preparation. If you prefer working with the database … Read more

Syncing local content with development / staging sites

Overview That’s the one main caveat of WordPress development, that even a seasoned WordPress developer still wonders what’s the perfect automation for syncing database content from local environment to live server. You can’t just upload your database dump from your local development environment to the server and be happy with the results. WordPress actually stores … Read more

How to initialize $wpdb?

First of all you probably created an isolated file that is not under the umbrella of WP files. That’s why you are not getting $wpdb. I guess you may not following the general rules/conventions of theme development. my question is now how are you accessing the file? whatever, if you include the wp_config.php in your … Read more