This topic contains 4 replies, has 2 voices, and was last updated by  Steve 5 months, 3 weeks ago.

  • Author
    Posts
  • #9251

    Alex Kladov
    Participant

    Hi,

    I have been trying to figure out why my Pages section was not being loaded correctly on my site and have narrowed it down to Piklist & Divi combination. Disabling either one fixes the issue. I am running latest versions of everything: WordPress v5.0.1, Piklist v1.0.1 & Divi v3.18.5.

    Here is what’s thrown in the error log:

    [13-Dec-2018 03:38:18 UTC] PHP Warning:  array_search() expects parameter 2 to be array, string given in /Applications/MAMP/htdocs/dev/weltrade/wp-content/themes/Divi/includes/builder/feature/BlockEditorIntegration.php on line 299
    [13-Dec-2018 03:38:18 UTC] PHP Fatal error:  Uncaught Error: Cannot unset string offsets in /Applications/MAMP/htdocs/dev/weltrade/wp-content/themes/Divi/includes/builder/feature/BlockEditorIntegration.php:301
    Stack trace:
    #0 /Applications/MAMP/htdocs/dev/weltrade/wp-includes/class-wp-hook.php(286): ET_Builder_Block_Editor_Integration->display_post_states('', Object(WP_Post))
    #1 /Applications/MAMP/htdocs/dev/weltrade/wp-includes/plugin.php(203): WP_Hook->apply_filters('', Array)
    #2 /Applications/MAMP/htdocs/dev/weltrade/wp-admin/includes/template.php(1933): apply_filters('display_post_st...', Array, Object(WP_Post))
    #3 /Applications/MAMP/htdocs/dev/weltrade/wp-admin/includes/class-wp-posts-list-table.php(943): _post_states(Object(WP_Post))
    #4 /Applications/MAMP/htdocs/dev/weltrade/wp-admin/includes/class-wp-posts-list-table.php(857): WP_Posts_List_Table->column_title(Object(WP_Post))
    #5 /Applications/MAMP/htdocs/dev/weltrade/wp-admin/includes/class-wp-list-table.php(1245): WP_Posts_List_Table->_column_title(Object(WP_Post), 'title column-ti...', 'data-c in /Applications/MAMP/htdocs/dev/weltrade/wp-content/themes/Divi/includes/builder/feature/BlockEditorIntegration.php on line 301

    what’s happening on the Pages section is only some of the lists of pages loads (8 in my case), and the rest of the page gets cutoff (WordPress crashes and does’t even add all closing footer tags, so the table is all messed up).

    Pages section in WordPress dashboard

    Regards,
    Alex

  • #9252

    Steve
    Keymaster

    Have you put in a ticket with Divi? The fatal error is coming from the theme.

  • #9253

    Alex Kladov
    Participant

    Hi Steve,

    Thank you for your response.

    Yes, I have logged a ticket with them regarding this issue and they have found a fix. Apparently Piklist was modifying the $post_states array and turning it into a NULL variable and they weren’t checking it, before trying to iterate through it to add their own status to pages, which was causing a fatal crash. Now they’ve implemented a fix, the issue is gone.

    If anyone is experiencing this issue, and wants to fix it before they will include this bug fix into their official release, you need to modify this file /wp-content/themes/Divi/includes/builder/feature/BlockEditorIntegration.php. You need to find function display_post_states (right it’s starting on line 288) and replace all of it with:

    
    	/**
    	 * Add 'Divi' to post states when builder is enabled for it.
    	 *
    	 * @param array $post_states Existing post states.
    	 * @param object $post Current post object.
    	 *
    	 * @return array
    	 */
    	public function display_post_states( $post_states, $post ) {
    		// Make sure that $post_states is an array. Third party plugin might modify $post_states and makes it null
    		// which create various issue (i.e. Piklist + Having a page configured as a static page)
    		if ( ! is_array( $post_states ) ) {
    			$post_states = array();
    		}	    
    	    
    		if ( et_pb_is_pagebuilder_used( $post->ID ) ) {
    			// Remove Gutenberg if existing
    			$key = array_search( 'Gutenberg', $post_states );
    			if ( false !== $key ) {
    				unset( $post_states[ $key ] );
    			}
    			// GB devs didn't allow this to be translated so why should we ?
    			$post_states[] = 'Divi';
    		}
    
    		return $post_states;
    	}

    However, I think there is still a general issue with Piklist. Why is it modifying the $post_states array and making it NULL? I do not believe that’s an intentional behaviour. So what ends up happening is that Piklist strips all post statuses from pages, which I am pretty sure is a bug. For example, Piklist will cause the “Front Page” post state to not display on the All Pages section in WP Dashboard.

    Regards,
    Alex

  • #9266

    Alex Kladov
    Participant

    Hi Steve,

    Thanks so much for the quick fix (I believe the latest v1.0.2 has addressed this bug):

    Piklist v1.0.2 Release notes

    Merry Christmas,
    Alex

  • #9267

    Steve
    Keymaster

    yes, 1.0.2 addresses the list table issue.

    Glad it’s working for you.

    Going to mark this resolved.

The topic ‘Piklist + Divi are crashing the admin Pages in WP dashboard’ is closed to new replies.