• Resolved Insomnia88

    (@insomnia88)


    I am getting a blank page when I try to add or edit a block. It is working on another site with a different configurations (still same server) but I can’t find the problem.

    • I don’t receive any errors (havn’t tried wp_debug though, just php error ini) on the page itself except for another one (advanced gutenberg settings page).
      The error there is
      Notice: Trying to get property 'post_type' of non-object in ...plugins/block-lab/php/blocks/class-loader.php on line 124
      Seems like it can’t set the posttype. I have hardcoded it manually but this didn’t solve my problem (maybe because there are other places I don’t know of?)
    • I did the wordpress health check: nothing special there
    • I deactivated all plugins: problem still exists

    Any ideas?

    • This topic was modified 5 years, 3 months ago by Insomnia88.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Luke Carbis

    (@lukecarbis)

    Is this for any block? Any block lab block? Just one block lab block?

    What fields are you using?

    Thread Starter Insomnia88

    (@insomnia88)

    It’s for new blocks and if I want to edits blocks. What do you mean with fields? This occurs on load of the page, not when I try to save or something.

    Thread Starter Insomnia88

    (@insomnia88)

    I think I found the problem. It kinda sucks though but at least I can work with it.
    I deactivated Gutenberg by default and unlocked it again only for my user (admin). This seems to break the plugin. The code I use is the following

    add_filter('use_block_editor_for_post_type', '__return_false', 5);
    add_filter('use_block_editor_for_post', '__return_false', 5);
    function customize_enable_gutenberg($can_edit, $post) {
    	$user_id = get_current_user_id();
    	if ($user_id === 1) {
    		return true;
    	}
    }
    add_filter('use_block_editor_for_post', 'customize_enable_gutenberg', 10, 2);

    I just turned the logic around – deactivating it for all except me – to get it working. Like this (if anyone has the same problem)

    if (is_user_logged_in()) {
    	$user_id = get_current_user_id();
    	if ($user_id !== 1) {
    		add_filter('use_block_editor_for_post_type', '__return_false', 10);
    		add_filter('use_block_editor_for_post', '__return_false', 10);
    	}
    }
    • This reply was modified 5 years, 3 months ago by Insomnia88.
    Plugin Author Luke Carbis

    (@lukecarbis)

    Hm… I’m guessing that code interferes with Block Lab’s use of the REST API. Good to know!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘blank page’ is closed to new replies.