Please, post your code because the problem is not the one you guessed.
Actually, $wpdb
is available very early: it is inited by the function require_wp_db()
located in the file wp_settings.php
at line #79.
The hook 'plugins_loaded'
is fired in the same wp_settings.php
file, but at line #237, so pretty after $wpdb
is available.
Related Posts:
- what is correct way to hook when update post
- How to return number of found rows from SELECT query
- Enforcing password complexity
- Can i use php sql functions instead of $wpdb?
- $wpdb->get_results(…) returns empty array despite correct query
- Does an activated plugin automatically mean its methods are available to other WP functions?
- How to set custom cookies before output
- $wpdb->delete column values IN ARRAY()?
- wpdb::prepare was called incorrectly
- Check php version before theme activation
- Getting the action’s tag name within the action
- Custom query to get post names beginning with a digit
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- queries inside of a class
- Action ‘save_post’ not working for quick edit
- Can i check if user is doing any ajax request?
- add_meta_boxes action with refresh on save
- How to display only first value of database column in WordPress
- Use wc_enqueue_js only on specific pages – nested add_action
- How to Remove a Filter from the Admin List Table?
- Print out WordPress user ID – two sites with same code but different output
- Insert post without actions/hooks
- Hooking new functions to actions + passing parameters
- Find variables available at a given hook
- WPDB: how to get the value of a field in a custom database table
- Why do filters/actions require an argument count?
- Can’t use get_results() in ajax query
- Appending meta value onto post content in WordPress during save_post
- save_post vs post_updated
- PHP syntax error when using wpdb update?
- Delete option value from array using update_option()
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- Export WordPress Table to CSV from page
- WordPress get pagination on wpdb get_results
- How to access function from outside of a class within this class in WP plugin?
- Extend a class of a plugin
- action hook wp_head higher priority as all other plugins/hooks
- How to use return in my custom function instead of echo
- WP_cron won’t trigger my action
- Advanced WordPress SQL Query
- Add two or multiple functions in WordPress Post or Page
- Update user_email via php – WP 4.7
- Submit to itself don’t work
- Unable to pass variable to database
- MySQL query in WordPress with AJAX
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Passed variable gets undefined variable error on insert on next page
- Run insert if no entry otherwise run update with ajax
- MySQL queries in WordPress
- WordPress HTML Helper
- Order by in foreach
- How to fetch results from database
- Using the same shortcode to show any table from the database
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Get null from POST
- Querying multiple meta_keys in WordPress SQL query
- How does add_action ‘comment_post’ work?
- Highlight posts currently being edited on multiple editor site?
- MySQL database migration to WordPress
- Custom action on comment post
- WordPress Plugin Receive a Link
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- How to add custom checkout field in user details mail template
- Fetching wpdb data from a php file seems to break?
- How do you get a reference to $wpdb in a PHP script
- Cannot modify header information – headers already sent
- Fix incorrect related posts code snippet
- Insert into db with foreach problem
- posts_clauses drop ACF get_field function
- How to display inputted data in Ajax without button or click event
- WordPress Query -> Ajax Query
- how to display tables via ajax
- Changing regular db connection to $wpdb
- Why a class property becomes empty?
- Can’t send form data to wpdb when URL has query string
- inner-wrap div pushing custom table far down on page
- use wpdb object on other file
- $wpdb how to make a record lookup
- How to change wp-admin and wp-login urls
- How to get data (not value or name) from radio options to POST to database
- Error resetting database index using ALTER TABLE in $wpdb->query
- I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
- How to sort custom sortable column by custom table value
- Warning: Undefined property: wpdb::$question_overview in C:\Wamp.NET\sites\proxyvragenmodule\wordpress\wp-includes\class-wpdb.php
- WordPress / PHP: Check if column has value and then check if value in array
- Putting form result in my database
- SQL – How to echo out inside of where statement
- How can I update a value of a field depending on outside source?
- Is there a hook that I can use when a fatal error occurs?
- Execute wp_after_insert_post after the permalink is customized
- Too few arguments – wp_login action
- Show post in elementor based on views and specific category with query id feature in elementor
- $wpdb->insert writes a record twice for some reason, when my custom developed plugin calls my class function once
- Disable RSS /feed/ endpoints on posts without disabling RSS overall
- How to properly prepare a column name if passed to a stored procedure?
- Unable to remove action from parent theme via child theme
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- get_var not returning a value when the field contains an apostrophe
- How to connect wordpress with db using ssl client certificate
- Trouble getting wpdb to work – first time