カテゴリー
WordPress

Warning: array_merge() [function.array-merge]: Argument #2 is not an array

WordPressでCutline 3-Column Right 1.1というテーマを使ってみようとダウンロードしてきて試したところ、下記のようなエラーが出ました。

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in …../wp-includes/widgets.php on line 60

エラー内容からちょっと検索してみると、

http://wordpress.org/support/topic/165568

The solution is located here:

http://wordpress.org/support/topic/148108

I put the one line of code in the widgets.php file on the line number that was the problem (for me it was line 60 – the old code was
$sidebar = array_merge($defaults, $args);

The proper code should be:
$sidebar = array_merge($defaults, (array)$args);

というWordpressに変更を入れる解決方法が出てきているのですが、

No, that’s not your problem. The real problem is in your theme, it’s making a call to the register_sidebar function with incorrect parameters. I suspect that it’s something like register_sidebar(2); in your theme’s functions.php file, when it should really be doing register_sidebars(2);. Note the extra “s”.

実はこれはテーマの方の問題で、テーマに含まれれるfunctions.phpの中で関数名に”s”を付け忘れているというのが真相だそうです。

/wp-content /themes/cutline-3-column-right-11/functions.phpの5行目にあるregister_sidebarに"s"を追加すればOKになりました。

/* blast you red baron! */
require_once (ABSPATH . WPINC . '/class-snoopy.php');

if ( function_exists('register_sidebars') )
register_sidebars(2);

$current = 'r167';
function k2info($show='') {

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です