[resolved] wpdb->prepare() calling convention has changed (3 posts)

  1. David Lingren
    Posted 3 years ago #

    In previous releases wp-includes/wp-db.php function prepare was defined as:

    function prepare( $query = null ) { // ( $query, *$args )

    in the latest beta release the definition is

    function prepare( $query, $args ) {

    This causes PHP (!) Warning messages for any call to prepare() that does not have %s/%d substitution parameters.

  2. Sergey Biryukov
    WordPress Dev
    Posted 3 years ago #

    This is intentional, see http://core.trac.wordpress.org/ticket/22262.

    If there are no placeholders in the query, there's no reason to run it through wpdb::prepare().

  3. Andrew Nacin
    Lead Developer
    Posted 3 years ago #

    If you're a user: Your site is fine. If you're a plugin/theme author, please read: http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/. If you're a user, please point your plugin/theme author to that post.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.