WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] White screen after adding custom post type support (4 posts)

  1. timm49
    Member
    Posted 1 year ago #

    Hi all,

    I know this problem is mentioned 100 times before already as I have tried to find my answer before posting, but I'm getting too annoyed.

    After adding some code to get a custom post type to the functions.php of my theme I'm creating, every time I'm updating a post, I get the white/blank screen.

    I tried increasing the memory limit, I have NO plugins installed, and I even tried to setup a totally new and fresh wordpress installation, but same thing happens there.

    When I switch to standard WP theme, there's no problem. Same goes for removing the custom post type code, then everything suddenly works fine again. Don't see anything bad in that code though.

    The custom post type appears in the menu btw, so it does work.

    Anyone has an idea? Thanks!!

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
        register_post_type( 'festivals',
            array(
                'labels' => array(
                    'name' => __( 'Festivals' ),
                    'singular_name' => __( 'Festival' ),
                    'add_new_item' => __('New festival'),
                    'add_new' => __('Add'),
                    'edit_item' => __('Edit festival'),
                    'new_item' => __('New festival'),
                    'all_items' => __('All festivals'),
                    'view_item' => __('View festival'),
                    'search_items' => __('Search festivals'),
                    'not_found' =>  __('No festivals found'),
                    'not_found_in_trash' => __('No festivals found in Trash'),
                    'parent_item_colon' => '',
                    'menu_name' => 'Festivals'
                ),
            'public' => true,
            'has_archive' => true,
            'menu_position'=>5,
            )
        );
    }
  2. timm49
    Member
    Posted 1 year ago #

    This is why I ask questions on forums - somehow always right after doing that I'm able to fix it myself...so weird.

    I still don't believe the error was actually because of this, but this is what fixed it - there were 2 empty lines (created by using <enter>) at the bottom of the functions.php file...

    Really..? That could be it? I can't believe it but hitting enter at the bottom of the file again, and the error is back!

  3. timm49
    Member
    Posted 1 year ago #

    So I'll mar it as solved btw :)

  4. red_A
    Member
    Posted 1 year ago #

    Thank you for posting back your solution, panic attack averted!

Topic Closed

This topic has been closed to new replies.

About this Topic