doushiposong30622 2015-10-19 03:56
浏览 32

如何修复由于自定义帖子类型导致的Wordpress 500内部服务器错误

I am using couponXL theme for my site. Everything is working correct but except one ie., custom post type. In the theme , there is a plugin called CouponXL custom post type. This plugin is included to enable custom post type feature for the theme.

Whenever I activate this plugin, server is responding with 500 internal server error. When I deactivate the plugin, server is running with no issue. So the issue must be with the custom post type.

When I looked into the server error logs. I found the following error,

] [notice] EACCELERATOR(810915): PHP crashed on opline 28 of array_merge() at /home/teachpkc/public_html/offers/wp-includes/functions.php:3076
] [notice] EACCELERATOR(803175): PHP crashed on opline 28 of array_merge() at /home/teachpkc/public_html/offers/wp-includes/functions.php:3076

Here is the plugin code for the custom post type

<?php
/*
Plugin Name: Coupon XL Custom Post Types
Plugin URI: http://demo.powerthemes.club/themes/couponxl/
Description: Coupon XL custom post types and taxonomies
Version: 1.0
Author: pebas
Author URI: http://themeforest.net/user/pebas/
License: GNU General Public License version 3.0
*/

if( !function_exists( 'couponxl_post_types_and_taxonomies' ) ){
    function couponxl_post_types_and_taxonomies(){
        $offer_args = array(
            'labels' => array(
                'name' => __( 'Offers', 'couponxl' ),
                'singular_name' => __( 'Offer', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-megaphone',
            'has_archive' => false,
            'supports' => array(
                'title',
                'editor',
                'thumbnail',
                'author',
                'excerpt',
                'comments'
            )
        );
        if( class_exists('ReduxFramework') && function_exists('couponxl_get_option') ){
            $trans_offer = couponxl_get_option( 'trans_offer' );
            if( !empty( $trans_offer ) ){
                $offer_args['rewrite'] = array( 'slug' => $trans_offer );
            }
        }
        register_post_type( 'offer', $offer_args ); 

        register_taxonomy( 'location', array( 'offer' ), array(
            'label' => __( 'Location', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Location', 'couponxl' ),
                'singular_name'                 => __( 'Location', 'couponxl' ),
                'menu_name'                     => __( 'Location', 'couponxl' ),
                'all_items'                     => __( 'All Locations', 'couponxl' ),
                'edit_item'                     => __( 'Edit Location', 'couponxl' ),
                'view_item'                     => __( 'View Location', 'couponxl' ),
                'update_item'                   => __( 'Update Location', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Location', 'couponxl' ),
                'new_item_name'                 => __( 'New Location Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Location', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Location:', 'couponxl' ),
                'search_items'                  => __( 'Search Locations', 'couponxl' ),
                'popular_items'                 => __( 'Popular Locations', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate locations with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove locations', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used locations', 'couponxl' ),
                'not_found'                     => __( 'No locations found', 'couponxl' ),
            )

        ) );


        register_taxonomy( 'offer_cat', array( 'offer' ), array(
            'label' => __( 'Offer Categories', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Offer Categories', 'couponxl' ),
                'singular_name'                 => __( 'Offer Category', 'couponxl' ),
                'menu_name'                     => __( 'Offer Category', 'couponxl' ),
                'all_items'                     => __( 'All Offer Categories', 'couponxl' ),
                'edit_item'                     => __( 'Edit Offer Category', 'couponxl' ),
                'view_item'                     => __( 'View Offer Category', 'couponxl' ),
                'update_item'                   => __( 'Update Offer Category', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Offer Category', 'couponxl' ),
                'new_item_name'                 => __( 'New Offer Category Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Offer Category', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Offer Category:', 'couponxl' ),
                'search_items'                  => __( 'Search Offer Categories', 'couponxl' ),
                'popular_items'                 => __( 'Popular Offer Categories', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate offer categories with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove offer categories', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used offer categories', 'couponxl' ),
                'not_found'                     => __( 'No offer categories found', 'couponxl' ),
            )

        ) );

        register_taxonomy( 'offer_tag', array( 'offer' ), array(
            'label' => __( 'Offer Tags', 'couponxl' ),
            'hierarchical' => false,
            'labels' => array(
                'name'                          => __( 'Offer Tags', 'couponxl' ),
                'singular_name'                 => __( 'Offer Tag', 'couponxl' ),
                'menu_name'                     => __( 'Offer Tag', 'couponxl' ),
                'all_items'                     => __( 'All Offer Tags', 'couponxl' ),
                'edit_item'                     => __( 'Edit Offer Tag', 'couponxl' ),
                'view_item'                     => __( 'View Offer Tag', 'couponxl' ),
                'update_item'                   => __( 'Update Offer Tag', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Offer Tag', 'couponxl' ),
                'new_item_name'                 => __( 'New Offer Tag Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Offer Tag', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Offer Tag:', 'couponxl' ),
                'search_items'                  => __( 'Search Offer Tags', 'couponxl' ),
                'popular_items'                 => __( 'Popular Offer Tags', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate offer tags with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove offer tags', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used offer tags', 'couponxl' ),
                'not_found'                     => __( 'No offer tags found', 'couponxl' ),
            )

        ) );

        $store_args = array(
            'labels' => array(
                'name' => __( 'Stores', 'couponxl' ),
                'singular_name' => __( 'Store', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-store',
            'has_archive' => false,
            'supports' => array(
                'title',
                'editor',
                'thumbnail'
            ),
        );
        if( class_exists('ReduxFramework') && function_exists('couponxl_get_option') ){
            $trans_store = couponxl_get_option( 'trans_store' );
            if( !empty( $trans_store ) ){
                $store_args['rewrite'] = array( 'slug' => $trans_store );
            }
        }
        register_post_type( 'store', $store_args ); 

        register_taxonomy( 'letter', array( 'store' ), array(
            'label' => __( 'Letters', 'couponxl' ),
            'hierarchical' => true,
            'labels' => array(
                'name'                          => __( 'Letters', 'couponxl' ),
                'singular_name'                 => __( 'Letter', 'couponxl' ),
                'menu_name'                     => __( 'Letter', 'couponxl' ),
                'all_items'                     => __( 'All Letters', 'couponxl' ),
                'edit_item'                     => __( 'Edit Letter', 'couponxl' ),
                'view_item'                     => __( 'View Letter', 'couponxl' ),
                'update_item'                   => __( 'Update Letter', 'couponxl' ),
                'add_new_item'                  => __( 'Add New Letter', 'couponxl' ),
                'new_item_name'                 => __( 'New Letter Name', 'couponxl' ),
                'parent_item'                   => __( 'Parent Letter', 'couponxl' ),
                'parent_item_colon'             => __( 'Parent Letter:', 'couponxl' ),
                'search_items'                  => __( 'Search Letters', 'couponxl' ),
                'popular_items'                 => __( 'Popular Letters', 'couponxl' ),
                'separate_items_with_commas'    => __( 'Separate letters with commas', 'couponxl' ),
                'add_or_remove_items'           => __( 'Add or remove letters', 'couponxl' ),
                'choose_from_most_used'         => __( 'Choose from the most used letters', 'couponxl' ),
                'not_found'                     => __( 'No letters found', 'couponxl' ),
            )

        ) );        

        register_post_type( 'voucher', array(
            'labels' => array(
                'name' => __( 'Vouchers', 'couponxl' ),
                'singular_name' => __( 'Voucher', 'couponxl' )
            ),
            'public' => true,
            'menu_icon' => 'dashicons-tickets-alt',
            'has_archive' => false,
            'supports' => array(
                'title',
            ),
            'capabilities' => array(
                'publish_posts' => 'manage_options',
                'edit_posts' => 'manage_options',
                'edit_others_posts' => 'manage_options',
                'delete_posts' => 'manage_options',
                'delete_others_posts' => 'manage_options',
                'read_private_posts' => 'manage_options',
                'edit_post' => 'manage_options',
                'delete_post' => 'manage_options',
                'read_post' => 'manage_options',
            ),          
        ));

        if( class_exists( 'Seravo_Custom_Bulk_Action' ) ){
            $bulk_actions = new Seravo_Custom_Bulk_Action( array('post_type' => 'voucher') );

            $bulk_actions->register_bulk_action(array(
                'menu_text' => __( 'Pay To Sellers', 'couponxl' ),
                'admin_notice'=> __( 'Sellers are paid', 'couponxl' ),
                'callback' => function( $post_ids ) {
                    couponxl_pay_all_sellers( $post_ids, 'no' );
                    return true;
                }
            ));

            $bulk_actions->init();
        }

    }
}
add_action('init', 'couponxl_post_types_and_taxonomies', 0);

?>

I have tried all solutions in the net but couldn't solve :( Could you please help me, what is the error and how to fix it :)

Note: I am using this theme in a sub-domain. Don't know whether the problem could be because of this. To your information guys I've added

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题