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

How to run Two WordPress blogs with different themes and with single database and same content

I’ll try to explain how it might be done, but not sure it will work: Install 2nd website with single db (2 copies). Create new table in your db. Call it wp_options2 and copy everything from wp_options into the new table in second install in wp-config.php, before if ( !defined(‘ABSPATH’) ) add define( ‘M7_OPTIONS_TABLE’, ‘wp_options2’ … Read more

Best way to import users, post and categories from an external database

Unless there is a core WordPress import filter available for your CMS ( see http://codex.wordpress.org/Importing_Content ) or a plugin for a CMS not covered by core WP ( see http://wordpress.org/extend/plugins/search.php?q=import ), or a Google search for your database schema doesn’t reveal anything, you need to roll your own importer. The best way is to write … Read more

Restore contents of deleted user

None that don’t involve a backup. If you have a backup, you’ll have to do some work to restore only a certain user’s data without resetting everything to that point. I’d say import the backup into an empty database, then copy data over either with SQL (INSERT INTO wp_posts SELECT FROM otherdb.wp_posts WHERE post_author = … Read more

How to change option recently_edited?

The function is update_recently_edited in wp-admin/includes/misc.php. unfortunately it is fixed at 5: function update_recently_edited( $file ) { $oldfiles = (array) get_option( ‘recently_edited’ ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $oldfiles = array_reverse( $oldfiles ); $oldfiles = array_unique( $oldfiles ); if ( 5 < count( $oldfiles )) array_pop( $oldfiles … Read more