Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未定义索引:Post类型_Php_Wordpress_Slider - Fatal编程技术网

Php 未定义索引:Post类型

Php 未定义索引:Post类型,php,wordpress,slider,Php,Wordpress,Slider,我在仪表板或Wordpress中收到此错误消息: 注意:未定义索引:第594行的post_type in/var/www/vhosts/dpsnet.frontier.ms/wp-content/plugins/responsive-slider/responsive-slider.php 我没有对代码进行自定义编辑。有人能帮忙吗?以下是与错误相关联的函数: function responsive_slider_column_order($wp_query) { if( is_admi

我在仪表板或Wordpress中收到此错误消息:

注意:未定义索引:第594行的post_type in/var/www/vhosts/dpsnet.frontier.ms/wp-content/plugins/responsive-slider/responsive-slider.php

我没有对代码进行自定义编辑。有人能帮忙吗?以下是与错误相关联的函数:

function responsive_slider_column_order($wp_query) {

    if( is_admin() ) {

        $post_type = $wp_query->query['post_type'];

        if( $post_type == 'slides' ) {
            $wp_query->set( 'orderby', 'menu_order' );
            $wp_query->set( 'order', 'ASC' );
        }
    }   
}

此错误来自插件内部

如果您正在处理插件,要解决此问题,您应该首先检查$wp\u query->query['post\u type']变量是否存在,如下所示:

if( isset($wp_query->query['post_type']) ) {
    $post_type = $wp_query->query['post_type'];

    if( $post_type == 'slides' ) {
        $wp_query->set( 'orderby', 'menu_order' );
        $wp_query->set( 'order', 'ASC' );
    }
}
如果您没有使用插件,您可能希望禁用插件的错误,只需为主题启用它们。为此,您可以将以下代码片段添加到wp-config.php中,位于wp_DEBUG常量定义的正下方:

function ignore_plugins_errors($errno, $errstr, $errfile, $errline, $errcontext) {
    if (defined('E_STRICT') && $errno==E_STRICT) {
        return;
    }

    $error_file = str_replace('\\', '/', $errfile);
    $content_dir = str_replace('\\', '/', WP_CONTENT_DIR . '/themes');

    if (strpos($error_file, $content_dir) === false) {
        return true;
    }
    return false;
}
set_error_handler('ignore_plugins_errors');

此错误来自插件内部

如果您正在处理插件,要解决此问题,您应该首先检查$wp\u query->query['post\u type']变量是否存在,如下所示:

if( isset($wp_query->query['post_type']) ) {
    $post_type = $wp_query->query['post_type'];

    if( $post_type == 'slides' ) {
        $wp_query->set( 'orderby', 'menu_order' );
        $wp_query->set( 'order', 'ASC' );
    }
}
如果您没有使用插件,您可能希望禁用插件的错误,只需为主题启用它们。为此,您可以将以下代码片段添加到wp-config.php中,位于wp_DEBUG常量定义的正下方:

function ignore_plugins_errors($errno, $errstr, $errfile, $errline, $errcontext) {
    if (defined('E_STRICT') && $errno==E_STRICT) {
        return;
    }

    $error_file = str_replace('\\', '/', $errfile);
    $content_dir = str_replace('\\', '/', WP_CONTENT_DIR . '/themes');

    if (strpos($error_file, $content_dir) === false) {
        return true;
    }
    return false;
}
set_error_handler('ignore_plugins_errors');

你想做什么?你想做什么?