php - 未定义的偏移量:Wordpress 中的 1
问题描述
我在 PHP 中收到以下错误
8 未定义的偏移量:1/Applications/MAMP/htdocs/wordpress/wp-content/plugins/wp-plugin/core.php 2178
这是导致它的PHP代码:
if (isset ( $attachements_to_attach ) && count ( $attachements_to_attach ) > 0) {
require_once (ABSPATH . 'wp-admin/includes/image.php');
foreach ( $attachements_to_attach as $attachements_to_attach_single ) {
$file = $attachements_to_attach_single [0];
$attachment = $attachements_to_attach_single [1];
$post_id = $id;
if (! function_exists ( 'wp_plugin_filter_image_sizes' )) {
function wp_plugin_filter_image_sizes($sizes) {
$sizes = array ();
return $sizes;
}
}
if (! in_array ( 'OPT_FEED_MEDIA_ALL', $camp_opt )) {
add_filter ( 'intermediate_image_sizes_advanced', 'wp_plugin_filter_image_sizes' );
}
$attach_id = wp_insert_attachment ( $attachment, $file, $post_id );
$attach_data = wp_generate_attachment_metadata ( $attach_id, $file );
wp_update_attachment_metadata ( $attach_id, $attach_data );
} <!-- error in this line
// remove sizes filter
remove_filter ( 'intermediate_image_sizes_advanced', 'wp_plugin_filter_image_sizes' );
}
解决方案
推荐阅读
- r - 保留一个特定列中具有空白值的行,并删除所有其他列中具有空白值的行
- r - 在 ggplot2 中绘图时组合具有相同名称的因子水平
- node.js - node.js & express - 从后端发送响应到前端
- filenames - 将文件名复制到具有相同编号的文件
- javascript - Using an object as a method's argument in es 6
- scala - 火花异常:java.lang.NoSuchMethodError:org.apache.http.conn.ssl.SSLConnectionSocketFactory
- scala - 使用 Spark 创建的 Hive 表在 HUE / Hive GUI 中不可见
- bash - 每当存在某个字符串时,将所有文件从文件夹 A 移动到 B
- sql - 为什么我会收到 ORA-00904:确定性函数索引的无效标识符?
- ios - 如何快速将 NSArray 合并到 NSMutableArray?