【问题标题】:Undefined index: post (wordpress plugin)未定义索引:post(wordpress 插件)
【发布时间】:2020-04-17 09:48:39
【问题描述】:

我使用查询监控插件检查了 WordPress,我得到了这个错误:

未定义索引:post
插件 n-custom-point 中的错误
错误位置是:

1- wp-content/plugins/n-custom-point/class/metabox-user-group.php:17 prefix_register_meta_boxes() 这是第 17 行

if($post->ID != $_REQUEST['post']) {  

2- wp-includes/class-wp-hook.php:287 apply_filters('rwmb_meta_boxes') 这是第 287 行

$value = call_user_func_array( $the_['function'], $args );

3- wp-content/plugins/n-custom-point/inc/meta-box/inc/core.php:50 RWMB_Core->register_meta_boxes() 这是第 50 行

$configs  = apply_filters( 'rwmb_meta_boxes', array() );

4- wp-includes/class-wp-hook.php:287 do_action('init') 这是第 287 行

$value = call_user_func_array( $the_['function'], $args );

5- wp-settings.php:540 这是第 540 行

do_action( 'init' );

我想知道如何解决这个问题。

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    这是一个 PHP 通知,可以通过更改以下行来修复:

    if($post->ID != $_REQUEST['post']) {  
    

    if( isset( $_REQUEST['post'] ) && $post->ID != $_REQUEST['post']) {  
    

    【讨论】:

    • 阿里通知不是大问题吗?我有另一个通知说 (Undefined variable: output) location wp-content/plugins/n-custom-point/n_custom_point.php:1490 n_lottery_winner_list() 并且第 1490 行是 $output .= "";你能建议吗
    • 注意只报告未初始化和未定义的变量,它也可以帮助解决变量名拼写错误,并且在大多数情况下可能不会引起问题,具体取决于应用程序,因此它实际上取决于该报告变量的使用,如果某些其他功能需要它,则该功能可能无法正常工作,而您甚至都没有注意到它。一般来说,这不是什么大问题,但最好始终确保所有内容都正确定义。
    • 非常感谢您的澄清,那么您能否建议如何解决我在之前的评论中发送的问题?
    • 您需要在$output .=...........................上方的第1490行之前声明像这样$output = "";这样的变量
    • 请您正确添加具体内容。对不起,我不是程序员这就是我问你的原因
    • 日期 彩票 中奖者
    猜你喜欢
    • 2014-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-13
    • 2015-03-31
    • 1970-01-01
    • 2018-05-31
    相关资源
    最近更新 更多