Numbered placeholders don’t work as you’d expect, and are going to be removed altogether at some point in the future, so should be considered invalid syntax.
So with this in mind, the error describes the problem- your query has 7 placeholders, but you only pass 4 values. For the repeated values, you just need to repeat them where you pass the substitutions.
Related Posts:
- Add custom post notice after post delete
- wp_logout_url() – WordPress Failure Notice
- Notices on the front-end
- Alter admin notices to remove message that contain a certain string
- PHP Notice: Undefined offset: 0
- Plugin activation/deactivation page transitions with page parameters, then vanished
- Using wpdb to connect to a separate database
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- How do you properly prepare a %LIKE% SQL statement?
- How to print the excuted sql right after its execution
- $wpdb->get_row() only returns a single row?
- Should I use wpdb prepare?
- WPDB Insert or if exists Update
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Showing errors with $wpdb update
- How to return number of found rows from SELECT query
- Is it mandatory to use $wpdb->prefix in custom tables
- wpdb->insert: do I need to prepare against SQL injection?
- get_results using wpdb
- WP_DEBUG is not set, but I’m still getting warnings
- How to programatically change username (user_login)?
- $wpdb won’t insert NULL into table column
- How to parse row results from $wpdb -> get_results
- Why $wpdb->show_errors() and print_error() is showing an output even if the query output is correct?
- what is the way to see the currently executing query in wordpress?
- How to pass parameters to admin_notices?
- Fetch array with $wpdb
- How do I check for a duplicate record before inserting using wpdb
- Pagination with custom SQL query
- Get error messages when $wpdb->insert() returns false?
- Return only Count from a wp_query request?
- Detecting errors generated by $wpdb->get_results()
- Is there anything like admin_notices for front end?
- Does dbDelta delete columns as well?
- WordPress 4.8.1 uses mysql_connect which doesn’t work with PHP 7
- wpdb update add current timestamp not working
- How to fetch Data in WordPress using MySQLi or $wpdb
- How to use $wpdb to delete in a custom table
- $wpdb->insert not working in any way
- WPDB prepare – like % – placeholders?
- How to delete all records from or empty a custom database table?
- dbDelta only creates the last table
- WordPress Paginate $wpdb->get_results
- wpdb->insert multiple record at once
- Differences between wpdb->get_results() and wpdb->query()
- $wpdb->insert_id
- Can i use php sql functions instead of $wpdb?
- Does a query executed through wpdb class get cached?
- $wpdb->update multiple rows, like IN in normal SQL
- What are the differences between wp_users and wp_usermeta tables?
- What is the best way to sanitize data?
- Matching database content types to PHP types
- $wpdb->get_results(…) returns empty array despite correct query
- Does $wpdb->prepare not create a prepared statement that I can execute multiple times?
- WordPress Unit Testing – Cannot Create Tables
- How to stop showing admin notice after close button has been clicked
- Use wpdb->prepare for `order by` column name
- How to define composite keys with dbDelta()
- get_the_ID() gives notice in 404 page
- get_results on large datasets
- Does wpdb add considerable overhead on queries with large result sets?
- $wpdb->insert() and Values for Datetime Columns?
- Hide php Notices in Dashboard
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- Check for success of $wpdb->update() correctly
- $wpdb->last_error doesn’t show the query on error
- Why does $wpdb return strings for mysql integer values?
- $wpdb->prepare() warning in WordPress 3.5
- how does $wpdb differ to WP_Query?
- wpdb get posts by taxonomy SQL
- So much data in postmeta
- $wpdb and MySQL Create Trigger
- Multisite posts in categories on network
- WordPress and multithreading
- find a random blogid across my multisite network that has at least one post published
- $wpdb->delete column values IN ARRAY()?
- wpdb::prepare was called incorrectly
- How to call a PHP function with Ajax when the user clicks a button
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- How to customize post edit notices
- Avoiding “Usage of a direct database call is discouraged”
- Inserting data into custom tables
- Hook into $wpdb
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- Get terms that contain posts that in turn belong to other terms?
- Display data from a non wordpress database on a page template
- How does $wpdb handle COUNT(*)
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- wpdb->prepare function remove single quote for %s in SQL statment
- dbDelta does not create Table, but returns success
- What is the advantage of the wp_options design pattern?
- Theoretical Multi-Server WordPress Setup with Shared Users
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Custom query to get post names beginning with a digit
- Multipart/formatted MySQL query problem
- Change post status based on meta value
- How might I retrieve a featured post image from an external WP site and display it as a link back?
- prepare() not working
- Get total number of comments from posts in a specific custom taxonomy