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:
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Getting the action’s tag name within the action
- 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
- Insert post without actions/hooks
- save_post vs post_updated
- action hook wp_head higher priority as all other plugins/hooks
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- Why is variable not working on custom sql query using wpdb?
- Remove an action hook within a Class
- Ajax not working es expected (Returns 0)
- How to pass arguments to add_action() or retrieve return value of called function?
- Can’t get wp_insert_post to work
- Trying to establish connection to External Database
- How to insert a single row to WP database table?
- Is it acceptable to treat a filter like an action?
- add element with add_action to posts from a specific category ID
- $wpdb->update with multiple parameters gives error
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- wp query foreach deleting record returning only first or last item
- action theme mailchimp subscriber fields
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Help with a $wpdb MySQL Query
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- jQuery code not working when included in functions.php
- Fatal error: Call to a member function query() on a non-object
- add_action taking an array with the 2nd argument?
- Should `wp_login` be used since it’s deprecated?
- How to show a users bio on a page
- Nested “do” and “add” Actions is possible?
- Change order of custom submenu link in WP Admin?
- Error using WordPress $wpdb object to get result from custom table
- How to retrieve the data from the sever and displaying it in a page?
- $wpdb returns duplicate posts
- Can’t update multiple rows with $wpdb query
- Mixing variables into an array when inserting values
- WordPress redirect redirecting too many times or not at all
- How can I add a new row in a separate database when someone registers via WordPress?
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- I can’t update my data through $wpdb
- Display attribute on shop page after the title
- Output: “Array”
- How to use mysql LIKE with wpdb?
- Delete database record using plugin from admin panel
- Cannot access $wpdb, comes back NULL
- Wpdb get->results to out the the month from the db
- How to use AJAX in WordPress in MYSQL query?
- Woocommerce custom Plugin in wordpress [closed]
- Why my query does not run with prepare
- WPDB secure custom form
- wpdb getting avatars and author url
- Add row to custom database Table and delete all rows older than 1 day
- WordPress SQL JOIN query
- Query the links Database
- Fetching review value using wpdb class
- MySQL Query Returns Array () In Shortcode
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Passing in MySQL prepare statement parameter separately throwing error
- Convert a column of a table containing an Array as response in HTML
- Database SQL query error
- WordPress Post Block Element not properly parsed with the_content filter
- Remove an action created by a Gravity Forms add-on
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- WordPress How do I pass a variable from one add_action to another?
- Conditional formatting on data fetched from MYSQL
- How do I remove an action hook inside a class that is called by another class?
- Modify post image in full size
- 403 Forbidden WordPress Database Results
- problem in using wpdb->prepare and a string placeholder
- Unable to pass arguments to function used in add_action
- Advanced WordPress SQL Query
- Add two or multiple functions in WordPress Post or Page
- Submit to itself don’t work
- MySQL query in WordPress with AJAX
- MySQL queries in WordPress
- 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)
- Querying multiple meta_keys in WordPress SQL query
- Highlight posts currently being edited on multiple editor site?
- 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
- How to display inputted data in Ajax without button or click event
- Why a class property becomes empty?
- Can’t send form data to wpdb when URL has query string
- $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
- 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?
- Execute wp_after_insert_post after the permalink is customized
- Too few arguments – wp_login action