微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何解决这个 PHP 错误尝试访问 wordpress 中 bool 类型值的数组偏移量?

如何解决如何解决这个 PHP 错误尝试访问 wordpress 中 bool 类型值的数组偏移量?

安装插件后,我的 wordpress 主题出现此错误。我使用的是 Amy Movies 3.5.2 主题插件Amy Movie Extends 3.5.4。我不知道这是否是导致问题的原因。它显示第 145 行的错误

    $permalinks     = get_option('amy_movie_permalinks');
    $cinema_slug    = ($permalinks['cinema_slug']) ? $permalinks['cinema_slug'] : 'cinema'; //This Line

这是我的完整 PHP 代码

<?PHP
if (!function_exists('amy_movie_create_postype_movie')) {
    function amy_movie_create_postype_movie() {
        $permalinks     = get_option('amy_movie_permalinks');
        $movie_slug     = isset($permalinks['movie_slug']) ? $permalinks['movie_slug'] : 'movie';

        $movie_args     = array(
            'labels'            => array(
                'name'          => esc_html__('Movies','amy-movie-extend'),'singular_name' => esc_html__('Movies','add_new_item'  => esc_html__('Add Movie','add_new'       => esc_html__('Add or Import Movie',),'public'                => true,'has_archive'           => false,'publicly_queryable'    => true,'exclude_from_search'   => false,'menu_icon'             => 'dashicons-video-alt','supports'              => array('title','editor','comments'),'rewrite'               => array(
                'slug'          => $movie_slug,'with_front'    => true,'Feeds'         => true,'pages'         => true,);

        register_post_type('amy_movie',$movie_args);
    }

    add_action('init','amy_movie_create_postype_movie');
}

// Genre
if (!function_exists('amy_movie_create_taxonomy_genre')) {
    function amy_movie_create_taxonomy_genre() {
        $permalinks     = get_option('amy_movie_permalinks');
        $genre_slug     = isset($permalinks['genre_slug']) ? $permalinks['genre_slug'] : 'genre';

        register_taxonomy('amy_genre',array('amy_movie','amy_tvshow'),array(
            'hierarchical'      => true,'labels'            => array(
                'name'              => esc_html__('Genres','singular_name'     => esc_html__('Genre','search_items'      => esc_html__('Search Genre','all_items'         => esc_html__('All Genres','parent_item'       => esc_html__('Parent Genre','parent_item_colon' => esc_html__('Parent Genre:','edit_item'         => esc_html__('Edit Genre','update_item'       => esc_html__('Update Genre','add_new_item'      => esc_html__('Add New Genre','new_item_name'     => esc_html__('New Genre Name','menu_name'         => esc_html__('Genres'),'show_ui'           => true,'show_admin_column' => true,'query_var'         => true,'rewrite'           => array(
                'slug'                  => $genre_slug,'with_front'            => true,'hierarchical'          => true,));
    }

    add_action('init','amy_movie_create_taxonomy_genre');
}

// Actor
if (!function_exists('amy_movie_create_taxonomy_actor')) {
    function amy_movie_create_taxonomy_actor() {
        $permalinks     = get_option('amy_movie_permalinks');
        $actor_slug     = isset($permalinks['actor_slug']) ? $permalinks['actor_slug'] : 'actor';

        register_taxonomy('amy_actor',array(
            'hierarchical'      => false,'labels'            => array(
                'name'              => esc_html__('Actors','singular_name'     => esc_html__('Actor','search_items'      => esc_html__('Search Actor','all_items'         => esc_html__('All Actors','edit_item'         => esc_html__('Edit Actor','update_item'       => esc_html__('Update Actor','add_new_item'      => esc_html__('Add New Actor','new_item_name'     => esc_html__('New Actor Name','menu_name'         => esc_html__('Actors'),'rewrite'           => array(
                'slug'                  => $actor_slug,));

    }

    add_action('init','amy_movie_create_taxonomy_actor');
}

// Director
if (!function_exists('amy_movie_create_taxonomy_director')) {
    function amy_movie_create_taxonomy_director() {
        $permalinks     = get_option('amy_movie_permalinks');
        $director_slug  = isset($permalinks['director_slug']) ? $permalinks['director_slug'] : 'director';

        register_taxonomy('amy_director','labels'            => array(
                'name'              => esc_html__('Directors','singular_name'     => esc_html__('Director','search_items'      => esc_html__('Search director','all_items'         => esc_html__('All Directors','edit_item'         => esc_html__('Edit Director','update_item'       => esc_html__('Update Director','add_new_item'      => esc_html__('Add New Director','new_item_name'     => esc_html__('New Director Name','menu_name'         => esc_html__('Directors'),'rewrite'           => array(
                'slug'                  => $director_slug,'amy_movie_create_taxonomy_director');
}

// Cinema
if (!function_exists('amy_movie_create_posttype_cinema')) {
    function amy_movie_create_posttype_cinema() {
        if ((amy_get_option('enable_m_cinema',true) == false) || (amy_get_option('enable_m_cinema',true) == true && amy_get_option('is_single_cinema',false) == true)) {
            return;
        }

/***********This Line***********/
/***********This Line***********/
/***********This Line***********/

        $permalinks     = get_option('amy_movie_permalinks');
        $cinema_slug    = ($permalinks['cinema_slug']) ? $permalinks['cinema_slug'] : 'cinema'; //Line 145 ERROR HERE

/***********This Line***********/
/***********This Line***********/
/***********This Line***********/




        register_post_type('amy_cinema',array(
                'labels' => array(
                    'name'          => esc_html__('Cinemas','singular_name' => esc_html__('Cinemas','public'        => true,'has_archive'   => true,'menu-icon'     => 'dashicons-building','supports'      => array('title','rewrite'       => array(
                    'slug'                  => $cinema_slug,)
        );
    }

    add_action('init','amy_movie_create_posttype_cinema');
}

// Custom Fields
if (!function_exists('amy_movie_custom_fields_create_taxonomy')) {
    function amy_movie_custom_fields_create_taxonomy() {
        $custom_fields = amy_get_option('movie_custom_fields');

        if (!empty($custom_fields)) {
            foreach ($custom_fields as $field) {
                if ($field['type'] == 'category' || $field['type'] == 'person') {
                    $name           = (isset($field['name']) && $field['name'] != '') ? $field['name'] : '';
                    $singular_name  = (isset($field['singular_name']) && $field['singular_name'] != '') ? sanitize_title($field['singular_name']) : sanitize_title($name);

                    register_taxonomy($singular_name,array(
                        'hierarchical'      => false,'labels'            => array(
                            'name'              => $name,'rewrite'           => array(
                            'slug'                  => $singular_name,));
                }
            }
        }
    }

    add_action('init','amy_movie_custom_fields_create_taxonomy');
}

if (!function_exists('amy_movie_create_post_type_tvshow')) {
    function amy_movie_create_post_type_tvshow() {
        if (amy_get_option('enable_m_cinema',true) == true) {
            return;
        }

        $permalinks     = get_option('amy_movie_permalinks');
        $tvshow_slug    = isset($permalinks['tvshow_slug']) ? $permalinks['tvshow_slug'] : 'tvshow';

        $args   = array(
            'labels'                => array(
                'name'                  => esc_html__('Tv Shows','amy-movie-helper'),'singular_name'         => esc_html__('Tv Show','search_items'          => esc_html__('Search Tv Show','all_items'             => esc_html__('All Tv Shows','edit_item'             => esc_html__('Edit Tv Show','update_item'           => esc_html__('Update Tv Show','add_new_item'          => esc_html__('Add New Tv Show','rewrite'               => array(
                'slug'                  => $tvshow_slug,'Feeds'                 => true,'pages'                 => true
            )
        );

        register_post_type('amy_tvshow',$args);
    }

    add_action('init','amy_movie_create_post_type_tvshow',12);
}

// register chapper post type.
if (!function_exists('amy_movie_create_post_type_season')) {
    function amy_movie_create_post_type_season() {
        if (amy_get_option('enable_m_cinema',true) == true) {
            return;
        }

        $permalinks     = get_option('amy_movie_permalinks');
        $season_slug    = isset($permalinks['season_slug']) ? $permalinks['season_slug'] : 'season';

        $args   = array(
            'labels'                => array(
                'name'                  => esc_html__('Seasons','singular_name'         => esc_html__('Season','search_items'          => esc_html__('Search Season','all_items'             => esc_html__('All Seasons','edit_item'             => esc_html__('Edit Season','update_item'           => esc_html__('Update Season','add_new_item'          => esc_html__('Add New Season','editor'),'rewrite'               => array(
                'slug'                  => $season_slug,'pages'                 => true
            )
        );

        register_post_type('amy_season','amy_movie_create_post_type_season',12);
}

有没有好心人能说一下如何解决这个错误

解决方法

显然 cluster.name: "xxxxxxxxxxx" bootstrap.memory_lock: false network.host: 0.0.0.0 network.publish_host: _ec2:privateIp_ transport.publish_host: _ec2:privateIp_ discovery.seed_providers: ec2 discovery.ec2.tag.project: xxxxxxx-elasticsearch discovery.ec2.endpoint: ec2.${REGION}.amazonaws.com s3.client.default.endpoint: s3.${REGION}.amazonaws.com cloud.node.auto_attributes: true cluster.routing.allocation.awareness.attributes: aws_availability_zone xpack.security.enabled: false 是假的,所以你需要确保它在那一行是真的

$permalinks

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。