WordPress adds prefixes to tables names, which was setup on installation. So by default there is wp_ prefix for tables names. It means that by default table name for links will be wp_links. But you shouldn’t care about standard tables name, because all of them exists as parameters of wpdb class (read Table section), so your query should be built like this:
$sql = "SELECT * FROM " . $wpdb->links;
$data = $wpdb->get_results($sql);
Related Posts:
- How to return number of found rows from SELECT query
- Can i use php sql functions instead of $wpdb?
- $wpdb->delete column values IN ARRAY()?
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- Custom query to get post names beginning with a digit
- WordPress get pagination on wpdb get_results
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- Why is variable not working on custom sql query using wpdb?
- Show MySQL errors that occur when I excute $wpdb->insert()
- Can’t get wp_insert_post to work
- WSoD being caused by this piece of code
- I want to select the from values from database in WordPress? [closed]
- Update results, Before deleting the related category [closed]
- wp query foreach deleting record returning only first or last item
- Database query works fine outside WordPress
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- $wpdb->insert() does not Insert record in a table
- Help with a $wpdb MySQL Query
- Custom array from a query only write the last row of the query
- $wpdb returns duplicate posts
- Mixing variables into an array when inserting values
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- Basic wpdb update question
- I can’t update my data through $wpdb
- Output: “Array”
- How to use mysql LIKE with wpdb?
- How do I prepare strings for insertions as values into a MySQL table?
- How to use AJAX in WordPress in MYSQL query?
- form $_post action value gets truncated after it passes through two forms
- Why won’t this wpdb get_results query return results?
- WPDB secure custom form
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- MySQL Query Returns Array () In Shortcode
- 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
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Conditional formatting on data fetched from MYSQL
- What is the correct way to search 3 custom fields only in WordPress?
- Using wpdb to connect to a different database is not working
- Rewrite SQL query as a prepared statement and use in foreach loop
- Advanced WordPress SQL Query
- MySQL query in WordPress with AJAX
- Passed variable gets undefined variable error on insert on next page
- MySQL queries in WordPress
- Using the same shortcode to show any table from the database
- MySQL database migration to WordPress
- MySQL update text field with ‘
- Error resetting database index using ALTER TABLE in $wpdb->query
- Putting form result in my database
- How can I update a value of a field depending on outside source?
- How to get the list of WooCommerce product image of a certain category from database?
- Changing user_nicename
- WordPress will not operate correctly
- tag search using WP_Query
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Sortable admin column for one meta key with three possible meta values
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Styling images coming from another blog
- How to convert objects into arrays
- Is there a way to get 3+ dimensional array from a single MySql command
- How to insert a single row to WP database table?
- mysql query from wordpress page using custom table
- Importing Geo data into wordpress database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- Using custom tables for old posts
- Multiple meta_key in one global $wpdb;
- WordPress member notification
- Location of core code for database connection and get_header
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Most commented posts by time period (last 12h, last 24h and etc)
- How to get specific attribute from DB
- Hide posts if user is added to it WP_query
- How to unserialize data from MySQL
- PHP -> SQL Query with Summing
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- Known Issues in WordPress When Upgrading PHP to ver 7
- Change MySQL PDO connection to a WPDB connection
- Get the id of the row from database on click of a button [closed]
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Display Results of SQL Query on WP site
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- How to display MySQL table data which is stored as an array?
- How to import woocommerce custom fields data into another site?
- 403 Forbidden WordPress Database Results
- At what point during a typical request does the $wpdb object become available?
- Let users register weight each day and save it in DB
- Fetching wpdb data from a php file seems to break?
- posts_clauses drop ACF get_field function
- 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
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder