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?
- Fatal error: Call to undefined function mysql_connect()
- Query both first_name and last_name from wp_usermeta at the same time
- How to add query vars with paginated URLs?
- How to Join two tables from separate databases within WordPress
- simple wordpress ajax plugin not working when not logged in
- Install will not load: PHP does not have MYSQL installed
- Insert post without actions/hooks
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to get the post_id from postmeta
- register_activation_hook isn’t adding table to DB
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- Custom Plugin For Converting CSV To MySQL
- Checking for new message using AJAX and PHP. Server overload?
- Trying to establish connection to External Database
- $wpdb->update with multiple parameters gives error
- inserting a post from an extern php file but post content doesn’t show on wp site
- $wpdb->wp_users returning empty value for
- Force Users To Relogin
- how to get serialized post meta
- A $_POST should occur when submit form but is not?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Using CFDB7 vs Custom MySQL Database [closed]
- Adding data to custom wordpress database table
- Undefined variable: row?
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- WordPress low speed after migrating to new host
- AWS Lightsail WordPress – connect to database on instance using mysqli
- call to undefined function mysql_connect
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Looping through custom data in a custom table to display all items in a post
- Insert data from form to database
- Prepared DB Query from _POST array
- Conditional statement within WP SQL query
- Run insert if no entry otherwise run update with ajax
- WordPress upload images not displaying
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- Custom query_posts() parameter
- Query Concatenation
- Display total count of products in orders of a specific order status
- how to display tables via ajax
- WordPress / PHP: Check if column has value and then check if value in array
- Can’t insert into a database wordpress