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
- $wpdb->get_results(…) returns empty array despite correct query
- How to set custom cookies before output
- $wpdb->delete column values IN ARRAY()?
- Check php version before theme activation
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- How to display only first value of database column in WordPress
- Use wc_enqueue_js only on specific pages – nested add_action
- Print out WordPress user ID – two sites with same code but different output
- 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
- Delete option value from array using update_option()
- 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
- How to use return in my custom function instead of echo
- WP_cron won’t trigger my action
- $wpdb->flush(); breaks the loop
- Show MySQL errors that occur when I excute $wpdb->insert()
- Any possible way to make $wpdb->get_results() return anything else than array?
- database interactions using OOP
- Adding Default Settings to Theme My Login plugin
- action is not called after a php request
- how to delete 30 day old data using PHP [closed]
- Echo a hierarchical list of post data from custom fields
- Custom Form Processing Issue
- Querying wpdb using PHP
- Trying to place a custom field after the total section in the checkout page in woocommerce
- Set meta field to publish date + 2 weeks
- Adding widgets to my plugin page instead of WordPress dashboard
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- Modify custom field input data before creating a new post
- Database query works fine outside WordPress
- $wpdb->insert() does not Insert record in a table
- 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
- Fatal error: Call to a member function query() on a non-object
- Should `wp_login` be used since it’s deprecated?
- How to show a users bio on a page
- Change order of custom submenu link in WP Admin?
- $wpdb returns duplicate posts
- Can’t update multiple rows with $wpdb query
- Wpdb->insert() doesn’t insert new row after the last one
- 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?
- How to get specific attribute from DB
- How to pass argument to add_action while the method is inside a class?
- Display attribute on shop page after the title
- How to use mysql LIKE with wpdb?
- PHP -> SQL Query with Summing
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- How to use AJAX in WordPress in MYSQL query?
- Change MySQL PDO connection to a WPDB connection
- Woocommerce custom Plugin in wordpress [closed]
- $wpdb->get_results breaking page?
- WPDB secure custom form
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- 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
- Database SQL query error
- WordPress SQL Prepare
- Remove an action created by a Gravity Forms add-on
- Use PHP Class in WordPress functions
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- I want to hide “sold by” on certain pages with id page 43
- What is the correct way to search 3 custom fields only in WordPress?
- 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
- MySQL query in WordPress with AJAX
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- MySQL queries in WordPress
- Order by in foreach
- Using the same shortcode to show any table from the database
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Highlight posts currently being edited on multiple editor site?
- WordPress Plugin Receive a Link
- How to add custom checkout field in user details mail template
- Fetching wpdb data from a php file seems to break?
- Fix incorrect related posts code snippet
- posts_clauses drop ACF get_field function
- WordPress Query -> Ajax Query
- how to display tables via ajax
- Changing regular db connection to $wpdb
- Can’t send form data to wpdb when URL has query string
- use wpdb object on other file
- $wpdb how to make a record lookup
- Error resetting database index using ALTER TABLE in $wpdb->query
- 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