$wpdb->tables[] = 'friends';
is the basic code you’re looking for.
Please note that you’ll want to test for the existence of the table in the list so you don’t wind up with 100 copies of the table in the tables array, especially if there’s a chance your code could be repeated within a page load.
UPDATED with example:
add_action( 'wp_loaded', 'add_table' );
function add_table() {
global $wpdb;
if ( ! in_array( 'friends', $wpdb->tables ) ) {
$wpdb->tables[] = 'friends';
}
}
Related Posts:
- Get plugin directory from a theme
- How to call a plugin function from index.php
- Rewriting every url
- category_name not working (not showing up in sql query debug)
- How can I make my custom shortcode work in a Custom HTML Widget?
- How Does WordPress Uninclude/Deactivate A Plugin?
- Custom admin column disappearing when using Quick Edit [duplicate]
- Create page when plugin is activated
- Custom plugin settings: clicking “save changes” does not display success message
- How to un-attach rich text editor from named textarea elements
- How can I translate the name of my Plugin for other languages?
- how to not show plugin in admin area
- Memory Leak in plugin action
- Getting User email on logout. wp_logout
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How can I filter blog name?
- Logs to check when the plugin was first installed for the first time
- Can a plugin add to header/footer/body content?
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- Custom preview_post_link not working for draft post
- wp_enqueue_script fails to include in footer
- jQuery function didn’t work in my plugin
- Auto add content such as pages upon plugin activation?
- How to make Http Request to a php file present in plugin directory of wordpress
- How to change commenter links to /user/user_id?
- Execute a plugin only on post pages
- First WordPress Plugin – Stat Issues
- How to use get_theme_mod in gutenberg editor wordpress?
- All Users > User List > Update User Meta Field Inline
- Correct way to perform non-cacheable DB query
- Updating the Drag-To-Share eXtended share URLs?
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- WordPress.org Plugin Directory doesn’t recognise screenshots [closed]
- How to check current user before all actions and filters?
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- How to Add Custom New Published Post Counter Icon on Top of the WordPress Site [closed]
- Adding CSS to custom post type admin page causes error
- Create shortcode to echo javascript
- Namespaced shortcode?
- How to pass variables to a function argument using add_action [duplicate]
- Activate my plugins via FTP
- How to add apply_filter for a class property in plugin
- wp_list_table class is not safe to use
- update_option_{$option} not showing old value
- creating a plug in that would tap into save/update action of posts [closed]
- How to prevent plugins from sniffing/stealing other plugins’ options?
- A server-side hook failed when committing plugin code to SVN
- Content-Security-Policy Headers are there and showing the correct settings, but still getting a refused connection
- SMTP Error: Could not authenticate [closed]
- Development of plugins to add components like JqueryUI
- plugin enqueue style on all pages
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Adding submenu to custom plugin menu page created with add_menu_page() function
- What is necessary to secure a WP plugin against direct file access attempts?
- why the wp_register_script doesn’t work for register_activation_hook
- Add a Custom Field in Comment Box next to the Text area
- How do you create a re-useable HTML fragment in wordpress
- Does WordPress check for updates of a plugin via plugins root folder name?
- How do i ‘deactivate’ a plugin only on a certain page template?
- Need to add/remove group of options and display them as rows
- Paypal Framework
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- GitHub plugins safe to use in my website?
- Order by post_date does not work in Previous and Next post pagination
- woocommerce: Customize email with item total count
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- The styles in the recent posts widgets plugin not working
- How to get the checkout form data from checkout page when place-order button is clicked
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- How to make WooCommerce multiple filter with custom meta fields
- Link custom post type to page
- implement checkbox or toggle switch in plugin code
- wordpress form not saving or updating
- How to put a maximum real-time users limit
- Custom admin plugin read CSV
- How can I call functions from a custom plugin?
- How to get short description under heading – Visual Composer [closed]
- plugin installing error
- Call function when save setting/option in custom admin page
- Plugin to Delete All Posts Monthly
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How can I use wp_ajax_response for front-end error reporting?
- Force download a file within plugin file
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- How can I use multi Media Uploader in a plugin?
- Is it possible to run javascript on plugin deactivated?
- Gutenberg: Dynamic Block – Show saved data in the editor
- How to fix ‘Call to undefined function do_settings()’ error?
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Wrong block appender button showing
- Uncaught Error: Cannot use object of type stdClass while showing the list using WP_List_Table
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files
- plugin doesn’t retrieve data from database