• Holah

    I recently upgraded an old site (had not checked in a long while) to the latest version , upon doing so, the theme started showing the following errors :

    Warning: Missing argument 2 for wpdb::prepare(), called in /srv/users/apps/uer/public/wp-content/themes/theme/lib/theme-sidebars.php on line 62 and defined in /srv/users/apps/user/public/wp-includes/wp-db.php on line 1192

    When i checked the theme-sidebars.php he lines around there are

    function celta_sidebars_creator() {
    	global $wpdb;
    	$widgetized_pages = $wpdb->get_col( $wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = celta_sidebar'" ) );
    	if( $widgetized_pages ){
    		foreach( $widgetized_pages as $w_page ){
    			$widget_id = strtolower( str_replace( ' ', '_', $w_page ) );
    			register_sidebar( array(
    				'name' => $w_page,
    				'id'   => 'celta_' . $widget_id,
    				'description'   => 'Drag your widgets into this area.',
    				'before_widget' => '<div id="%1$s" class="widget %2$s">',
    				'after_widget' => '</div>',
    				'before_title' => '<h3 class="widget-title">',
    				'after_title' => '</h3>'
    			));
    		}
    	}
    }
    ?>

    What can i change in those lines to fix this ?

Viewing 1 replies (of 1 total)
  • Try changing this:

    $widgetized_pages = $wpdb->get_col( $wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = celta_sidebar'" ) );

    to this:

    $widgetized_pages = $wpdb->get_col( $wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s", 'celta_sidebar' ) );

Viewing 1 replies (of 1 total)
  • The topic ‘Theme problem after upgrading wordpress’ is closed to new replies.