Support » Fixing WordPress » Plugin producing unexpected output on activitation

  • Hi. I have a plugin which works perfectly on other sites but when I try install on one of my sites its not working. When I try activate the plugin it was producing a fatal error showing an unexpected }. I’
    ve stripped back the plugin to bare essentials and discovered it seems to be echoing the plugin rather than executing – just on this WP install.

    Here is the plugin code:

    Plugin Name: Squigloo Slider
    Description: Custom built slider
    Version: 1.0
    Author: Kat McGowan
    /* WP actions */
    add_action('init', 'sq_slider_register');
    //Create Custom Post Type
    function sq_slider_register()
    	$labels = array(
    	  'name' => 'Slides',
    	  'singular_name' => 'Slide',
    	  'menu_name' => 'Slides',
    	  'add_new' => 'Add Slide',
    	  'add_new_item' => 'Add New Slide',
    	  'edit' => 'Edit',
    	  'edit_item' => 'Edit Slide',
    	  'new_item' => 'New Slide',
    	  'view' => 'View Slide',
    	  'view_item' => 'View Slide',
    	  'search_items' => 'Search Slides',
    	  'not_found' => 'No Slides Found',
    	  'not_found_in_trash' => 'No Slides Found in Trash',
    	  'parent' => 'Parent Slide'
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'menu_position' => 4,
    		'capability_type' => 'post',
    		'hierarchical' => true,
    		'rewrite' => array('slug' => 'slides'),
    		'query_var' => true,
    		'supports' => array('title','editor','thumbnail','page-attributes')
    	register_post_type( 'sq_slides' , $args );

    When I activate the plugin it outputs to the top of the page the plugins code starting from the first =>. Eg ‘Slides’, ‘singular_name’ => ‘Slide’, ‘menu_name’ => ‘Slides’, ‘add_new’ => ‘Add Slide’… etc all the way to the closing php tag.

    Then on the plugins page it tells me ‘The plugin generated 1617 characters of unexpected output during activation’ etc.

    Why would it be outputting rather than executing this code?

    Using WordPress 3.4.1 on PHP5.3.3 Apache server.

Viewing 1 replies (of 1 total)
  • Quick update. I tried commenting out register_post_type( 'sq_slides' , $args ); and the plugin activated without any issues. But obviously this doesnt help me as I need to register the custom post types for this to work.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin producing unexpected output on activitation’ is closed to new replies.