Support » Plugins and Hacks » Redirection » [Resolved] Missing argument 2 for wpdb::prepare()

[Resolved] Missing argument 2 for wpdb::prepare()

  • Full description of warning is: Warning: Missing argument 2 for wpdb::prepare(), called in /public_html/wp-content/plugins/redirection/models/group.php on line 70 and defined in /public_html/wp-includes/wp-db.php on line 992

    Looks like there’s some sort of conflict with the newly launched WP 3.6. Fixing this will be really appreciated, since this plugin has proved to be an indispensible one.

    Thank you!


Viewing 15 replies - 1 through 15 (of 34 total)
  • I would also be keen to know how to fix this.

    Hello John,

    we are also getting this error. It appears in Tools -> Redirection only.


    I have the same problem, how to fix it ?

    I had this issue in my functions.php

    $post_count = $wpdb->get_var( $wpdb->prepare($sql));

    $post_count = $wpdb->get_var( $wpdb->prepare($sql, $count));

    I do not understand it exactly, but I looked it up on CODEX and everything still works, I just added the $count at the end.

    Yup- updated to WP 3.6 and Warning: Missing argument 2 for wpdb::prepare(), called in …/plugins/redirection/models/group.php on line 70 and defined in …/wp-includes/wp-db.php on line 992

    It’s unfortunately not a WordPress bug … it’s a developers mistake like MCM confirms 🙂

    See also: Prepare Missing Argument and PHP Warning Missing Argument.

    I got the same issue appearing on the plugin settings page in WP dashboard. John please add the patch needed cos this plugin rocks. Least it does still work in the meantime.

    Same problem here. This error should not be hard to fix but I am traveling right now.
    Line 70:
    $rows = $wpdb->get_results( $wpdb->prepare( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" ) );

    Also there seems to be a bad link with the URL at the top of the page “Redirections for group: Redirections”


    I also noticed there has not been any development since 2012. Does anyone recommend an updated plugin or want to start the development back up for this one?

    Remove the plugin and try fancy gallery lite. It only supports 1 gallery free under 3.6 but it works really well. Worth paying $29 for the full version.

    I’m sure there are others too but this one is simple to use, worked first shot, and has many more options and features than I’ll ever use.

    Here is the fix

    On line 70 of redirection/models/group.php
    Remove the “( $wpdb->prepare” and ” )” at the end

    @laserjobs: thanks! Your fix works.

    @laserjobs; Thanks!!! it works.

    Thanks @laserjobs that fixed it!

    Also had this problem and the gist fix works. Thanks.

    the redirection plug causes my homepage to disappear!
    only when I deactivate the plug I can see my homepage.

    I cloned the site to develop server, you can see it here:

    you see? – blank homepage. all the other pages are working fine.

    Is there a way to fix it?

Viewing 15 replies - 1 through 15 (of 34 total)
  • The topic ‘[Resolved] Missing argument 2 for wpdb::prepare()’ is closed to new replies.