WordPress.org

Ready to get started?Download WordPress

Forums

plugin breaks site (1 post)

  1. peteratld
    Member
    Posted 4 months ago #

    I created a simple plugin directory in /plugins and inserted a .php file to create some custom taxonomies.
    I then activated the plugin and everything was good in the backend. I could navigate around with no problem. I could upload files okay. I could edit stylesheets in the editor without trouble until I tried to SAVE the changes. Then, the screen went white.
    I have uninstalled and reinstalled the plugin several times, both by FTP and ADD NEW/Upload in the plugin manager to no avail.
    Once the screen goes white, hitting the BACK button takes me back to the previous screen and then, if I go to the Plugin Manager, I see the plugin has been deactivated.
    I tried this plugin in a sandbox environment running the same theme on the same version of WordPress and it worked just fine.
    I tried using a .php file with nothing more in it than the name and description of the plugin (commented out) inside opening and closing php tags. This had no effect in the sandbox site but it whited out the dev site.

    I have included the php file below.

    Can anybody helpm e?

    Thanks

    Peter

    <?php
    /*
    Plugin Name:  Taxonomies
    Plugin URI: http://www.webignite.com.au
    Description: Custom taxonomies for Ambassador Catering Equipment
    Version: 1.0.0
    Author: Peter Gleeson | Web Ignite
    Author URI: http://www.webignite.com.au
    */
    /*Start custom taxonomies*/
    //hook into the init action and call create_book_taxonomies when it fires
    	add_action( 'init', 'create_product_cat_sub1_hierarchical_taxonomy', 0 );
    
    	//create a custom taxonomy name it product_cat_sub1 for your posts
    
    function create_product_cat_sub1_hierarchical_taxonomy() {
    
    	// Add new taxonomy, make it hierarchical like categories
    	//first do the translations part for GUI
    
    	  $labels = array(
    	    'name' => _x( 'product_cat_sub1', 'taxonomy general name' ),
    	    'singular_name' => _x( 'product_cat_sub1', 'taxonomy singular name' ),
    	    'search_items' =>  __( 'Search product_cat_sub1' ),
    	    'all_items' => __( 'All product_cat_sub1' ),
    	    'parent_item' => __( 'Parent product_cat_sub1' ),
    	    'parent_item_colon' => __( 'Parent product_cat_sub1:' ),
    	    'edit_item' => __( 'Edit product_cat_sub1' ),
    	    'update_item' => __( 'Update product_cat_sub1' ),
    	    'add_new_item' => __( 'Add New product_cat_sub1' ),
    	    'new_item_name' => __( 'New product_cat_sub1 Name' ),
    	    'menu_name' => __( 'product_cat_sub1' ),
    	  );   
    
    	// Now register the taxonomy
    
    	  register_taxonomy('product_cat_sub1',array('post'), array(
    	    'hierarchical' => true,
    	    'labels' => $labels,
    	    'show_ui' => true,
    	    'show_admin_column' => true,
    	    'query_var' => true,
    	    'rewrite' => array( 'slug' => 'product_cat_sub1' ),
    	  ));
    
    	}	  
    
    	  //hook into the init action and call create_book_taxonomies when it fires
    	add_action( 'init', 'create_product_cat_sub2_hierarchical_taxonomy', 0 );
    
    	//create a custom taxonomy name it product_cat_sub2 for your posts
    
    function create_product_cat_sub2_hierarchical_taxonomy() {
    
    	// Add new taxonomy, make it hierarchical like categories
    	//first do the translations part for GUI
    
    	  $labels = array(
    	    'name' => _x( 'product_cat_sub2', 'taxonomy general name' ),
    	    'singular_name' => _x( 'product_cat_sub2', 'taxonomy singular name' ),
    	    'search_items' =>  __( 'Search product_cat_sub2' ),
    	    'all_items' => __( 'All product_cat_sub2' ),
    	    'parent_item' => __( 'Parent product_cat_sub2' ),
    	    'parent_item_colon' => __( 'Parent product_cat_sub2:' ),
    	    'edit_item' => __( 'Edit product_cat_sub2' ),
    	    'update_item' => __( 'Update product_cat_sub2' ),
    	    'add_new_item' => __( 'Add New product_cat_sub2' ),
    	    'new_item_name' => __( 'New product_cat_sub2 Name' ),
    	    'menu_name' => __( 'product_cat_sub2' ),
    	  );   
    
    	// Now register the taxonomy
    
    	  register_taxonomy('product_cat_sub2',array('post'), array(
    	    'hierarchical' => true,
    	    'labels' => $labels,
    	    'show_ui' => true,
    	    'show_admin_column' => true,
    	    'query_var' => true,
    	    'rewrite' => array( 'slug' => 'product_cat_sub2' ),
    	  ));
    
    	}
    
    	//hook into the init action and call create_book_taxonomies when it fires
    	add_action( 'init', 'create_product_cat_sub3_hierarchical_taxonomy', 0 );
    
    	//create a custom taxonomy name it product_cat_sub3 for your posts
    
    function create_product_cat_sub3_hierarchical_taxonomy() {
    
    	// Add new taxonomy, make it hierarchical like categories
    	//first do the translations part for GUI
    
    	  $labels = array(
    	    'name' => _x( 'product_cat_sub3', 'taxonomy general name' ),
    	    'singular_name' => _x( 'product_cat_sub3', 'taxonomy singular name' ),
    	    'search_items' =>  __( 'Search product_cat_sub3' ),
    	    'all_items' => __( 'All product_cat_sub3' ),
    	    'parent_item' => __( 'Parent product_cat_sub3' ),
    	    'parent_item_colon' => __( 'Parent product_cat_sub3:' ),
    	    'edit_item' => __( 'Edit product_cat_sub3' ),
    	    'update_item' => __( 'Update product_cat_sub3' ),
    	    'add_new_item' => __( 'Add New product_cat_sub3' ),
    	    'new_item_name' => __( 'New product_cat_sub3 Name' ),
    	    'menu_name' => __( 'product_cat_sub3' ),
    	  );   
    
    	// Now register the taxonomy
    
    	  register_taxonomy('product_cat_sub3',array('post'), array(
    	    'hierarchical' => true,
    	    'labels' => $labels,
    	    'show_ui' => true,
    	    'show_admin_column' => true,
    	    'query_var' => true,
    	    'rewrite' => array( 'slug' => 'product_cat_sub3' ),
    	  ));
    
    	}	  
    
    //hook into the init action and call create_book_taxonomies when it fires
    	add_action( 'init', 'create_product_cat_sub4_hierarchical_taxonomy', 0 );
    
    	//create a custom taxonomy name it product_cat_sub4 for your posts
    
    function create_product_cat_sub4_hierarchical_taxonomy() {
    
    	// Add new taxonomy, make it hierarchical like categories
    	//first do the translations part for GUI
    
    	  $labels = array(
    	    'name' => _x( 'product_cat_sub4', 'taxonomy general name' ),
    	    'singular_name' => _x( 'product_cat_sub4', 'taxonomy singular name' ),
    	    'search_items' =>  __( 'Search product_cat_sub4' ),
    	    'all_items' => __( 'All product_cat_sub4' ),
    	    'parent_item' => __( 'Parent product_cat_sub4' ),
    	    'parent_item_colon' => __( 'Parent product_cat_sub4:' ),
    	    'edit_item' => __( 'Edit product_cat_sub4' ),
    	    'update_item' => __( 'Update product_cat_sub4' ),
    	    'add_new_item' => __( 'Add New product_cat_sub4' ),
    	    'new_item_name' => __( 'New product_cat_sub4 Name' ),
    	    'menu_name' => __( 'product_cat_sub4' ),
    	  );   
    
    	// Now register the taxonomy
    
    	  register_taxonomy('product_cat_sub4',array('post'), array(
    	    'hierarchical' => true,
    	    'labels' => $labels,
    	    'show_ui' => true,
    	    'show_admin_column' => true,
    	    'query_var' => true,
    	    'rewrite' => array( 'slug' => 'product_cat_sub4' ),
    	  ));
    
    	}	  
    
    //hook into the init action and call create_book_taxonomies when it fires
    	add_action( 'init', 'create_product_cat_sub5_hierarchical_taxonomy', 0 );
    
    	//create a custom taxonomy name it product_cat_sub5 for your posts
    
    function create_product_cat_sub5_hierarchical_taxonomy() {
    
    	// Add new taxonomy, make it hierarchical like categories
    	//first do the translations part for GUI
    
    	  $labels = array(
    	    'name' => _x( 'product_cat_sub5', 'taxonomy general name' ),
    	    'singular_name' => _x( 'product_cat_sub5', 'taxonomy singular name' ),
    	    'search_items' =>  __( 'Search product_cat_sub5' ),
    	    'all_items' => __( 'All product_cat_sub5' ),
    	    'parent_item' => __( 'Parent product_cat_sub5' ),
    	    'parent_item_colon' => __( 'Parent product_cat_sub5:' ),
    	    'edit_item' => __( 'Edit product_cat_sub5' ),
    	    'update_item' => __( 'Update product_cat_sub5' ),
    	    'add_new_item' => __( 'Add New product_cat_sub5' ),
    	    'new_item_name' => __( 'New product_cat_sub5 Name' ),
    	    'menu_name' => __( 'product_cat_sub5' ),
    	  );   
    
    	// Now register the taxonomy
    
    	  register_taxonomy('product_cat_sub5',array('post'), array(
    	    'hierarchical' => true,
    	    'labels' => $labels,
    	    'show_ui' => true,
    	    'show_admin_column' => true,
    	    'query_var' => true,
    	    'rewrite' => array( 'slug' => 'product_cat_sub5' ),
    	  ));
    
    	}	  
    
    ?>

Reply

You must log in to post.

About this Topic