Created
May 15, 2014 18:43
-
-
Save dannyockilson/e5fbd38ca4a25c98ef7a to your computer and use it in GitHub Desktop.
Set custom Wordpress Options Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this into wp-db.php at line 954 | |
if ( isset( $tables['options'] ) && defined( 'CUSTOM_OPTIONS_TABLE' ) ) | |
$tables['options'] = CUSTOM_OPTIONS_TABLE; | |
?> | |
<?php | |
// Add this to your wp config file | |
define('CUSTOM_OPTIONS_TABLE', 'api_options'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this may seem like a mental thing to do but we had an app that used a custom api to connect to an old site, the site was updated and the new version ran on wordpress. Instead of writting another custom api (that we'd have to update in line with the site) I made a duplicate of the wordpress install, using the same database, copied the wp_options table and renamed it api_options and added this function. Now I can change settings for the api, deactivate plugins and change the theme for the api while still having access to all the content from the main site. I know a multisite install could do this to an extent but this allows the api to be hosted separately from the main site.