Calling wp_set_wpdb_vars()
after replacing $wpdb
will probably do the trick.
$wpdb = new My_DB();
wp_set_wpdb_vars();
However, the only officially supported way to replace wpdb
is to place a db.php
in wp-content folder. If you can, I would suggest to do that.
Related Posts:
- dbDelta only creates the last table
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Correct way to perform non-cacheable DB query
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- Change commission_status paid when withdraw_status vendor is completed
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- WPDB: Update table
- Issue running db create table query from static method
- Displaying data from another database
- How to securely controlling data without keeping it in postmeta?
- Using id to show item
- Proper way to trigger a MySQL query via link in a plugin
- get_var result empty for query of custom table in plugin admin
- WP-Snap too slow (caused by WP_Query?)
- Get all the related data from WordPress DB
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Namespaces in WordPress – How do I initiate the main class?
- Editor access to plugin settings
- How to use a Must-Use plugin to hide a regular one and to hide itself?
- Custom Post Type Statuses
- How does wordpress distinguish a plugin’s main php file from other php files? [duplicate]
- Insert code after tag without using functions.php?
- Plugin: How should I handle deleting comments?
- wordpress plugin that show my reputation (points) in any stackexchange project in my wordpress blogs
- Why load_textdomain work but not load_plugin_textdomain?
- Extend the Admin Post/Edit page
- Passing select control value to block
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- send_headers don’t work on wordpress multisite
- Why was my plugin rejected from the WordPress.org repository?
- $wpdb working with ajax but showing ajax error instead of success
- Adding content before the loop in category pages
- admin_notices hook show message all admin pages after plugin activate
- Inserting large amounts of data into a custom table during plugin install
- How to define WordPress plugin shortcode globally for multisite?
- how to Include json manifest file in wp plugin
- White page on custom plugin option submit
- Input with spaces in Shortcode attributes overwritten by defaults
- Unable to override pluggable function wp_mail
- Avoid class name collision when using third party libraries in plugins?
- How to find the origin of a file upload from within wp_handle_upload?
- WP All Import – Execute Imports
- How to set taxonomy in custom plugin?
- Plugin development: Buggy plugin preview
- how to use in custom single.php template using php?
- How can I change the meta_key for a particular piece of information?
- Howto check version of another plugin and then add a submenu page to it
- Which file of wordpress manage plugins functionalities?
- How can i create page through plugin
- I should enable automatic updates?
- Check if variable is set in filter
- How to add custom table style for table block in gutenberg editor
- Does using `add_action( ‘init’…` cause performance issues?
- How to write “alt” tag in image for wordpress code?
- Issues with a WP plugin menu system
- Different custom templates for product category [closed]
- How to create plugin/ page that reads from database
- problem with sql query
- Add a “View all” button on WooCommerce product archives pages
- How do I add an options page at the bottom of the list?
- WordPress Active Plugins
- is it possible to hook every page style?
- Redirect logged in user to somepage on every page view?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- Adding a jQuery modal dialog to the admin area
- How to make a Product page without ordering and database
- wp_options not returning value for logged out users?
- Gutenberg default attributes are empty when accessing in edit
- Cannot run script properly with my custom plugin
- Cookie value changes back to previous value after changing
- Hide all Admin Notices and move on a separate page
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- Highlight admin menu items that are parent of existing core items
- How to create algorithm for ordering posts in WordPress?
- Adding shortcodes to multiple pages with function
- Getting all woocommerce products from REST API call in plugin
- AJAX update fails for public/non-admin users
- Get a list of Product Categories inside a loop
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- WordPress plugin changes not updating
- wordpress ajax pagination object value does not change
- Google analytic issue in wordpress
- Create Database Tables on Plugin Activation hook
- What’s the preferred method of writing AJAX-enabled plugins?
- Change page according to fetched GET Parameters
- Shortcode registered from a plugin not recognized
- How to change a specific page to custom page?
- wp_update_post call really slow when official Facebook plugin is installed
- How use Dynamic hyperlink on each wordpress post?
- _e in wordpress +
- WordPress Code Access to Restricted Content without Registration
- how to make wordpress remember my choice
- Meta box not displaying on the plugin page
- wordpress admin-ajax bad request 400
- public custom posts not showing in my wordpress plugin