• Resolved kachmar97

    (@kachmar97)


    Hi,

    On my website, I don’t see PublishPress Blocks in my Gutenberg blocks list.
    Earlier all was good. On my website I use PHP 8.2 version, but also tried rollback to 7.4 – result was the same.

    I checked my Preferences when I edit some post and I can’t find all PublishPress Blocks there. I can see only Content Display – PublishPress
    https://prnt.sc/6Pf55kEEYmgc

    Toggles for your plugin looks like that
    https://prnt.sc/wAhf6Aadq-h4

    Blocks permission you can find here:
    https://prnt.sc/jvCJ8Nr2jmm1

    This is what I see when I’m trying to find Accordion – PublishPress

    Help me please with it
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @kachmar97

    Thanks for using PublishPress Blocks.

    Could you please perform some basic troubleshooting, such as deactivating other plugins and switching to a different theme, to check if there is any plugin conflict causing this issue?

    Thanks

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. If you have any further questions, please reply again here, or you can start a new thread.

    Thanks,

    Bence Szalai

    (@grapestain)

    I am having a very similar issue, except for me the Content Display block was missing, others were fine.
    Turns out that the var advgb_blocks_vars = { line that should contain a JSON under the original_settings.styles array had an object, who’s css property was not a css, but an HTML. Being so escaping somehow failed, so eventually this variable as well as subsequent variables, including advgbBlocks were never set on the editor screens.

    Indeed the CSS ended up being an HTML because a CSS file was not where it was supposed to be, which ended up resulting in the WordPress 404 HTML. I’ve added < !-- < ?= $ _SERVER['REQUEST_URI'] ?> --> to the top of the head of my theme to find out the missing CSS file.

    Eliminating the wrong CSS enqueuing fixed the issue.

    On one hand I’ve written it in hope that it may help others facing similar issues.

    But on the other hand I’m wondering how it is possible? AdvancedGutenbergMain::$original_block_editor_setting is added to the page using the standard wp_localize_script. How come escaping breaks when one of the array members end up being an HTML instead of CSS? It is supposed to go through json_encode so it shouldn’t matter. Still, the JSON is broken…

    So looking into it more, turns out WordPress is quite naive when encoding json in the localize script call calling wp_json_encode without any options, which in turn calls PHP json_encode without options. Adding JSON_HEX_TAG to the call fixes the broken JSON and thus the missing PublishPress blocks issue as well.

    UPDATE: So it turns out the issue is caused by another plugin which injects CSS files using non standard method, that is it buffers all HTML output, then searches for </head> and adds it’s style links before that tag. Since the inline JS object created by wp_localize_script contains the token </head> due to a whole 404 HTML is included instead of a CSS, now this script finds that tag, and injects it’s <style... tag before. However indeed this tag contains a " which closes the JSON string and breaks the object structure. The only reason adding JSON_HEX_TAG “fixed” the issue, is that </head> became \u003C/head\u003E which was now immune to that non standard behaviour.

    This being said, my issue might have been a different one than OPs, but in may be related. My takeaway: If PublishPress blocks are missing, check the console for Uncaught SyntaxError: missing } and Uncaught ReferenceError: advgbBlocks is not defined errors, as it may point into the direction of solution.

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    @grapestain Thank you for sharing your finding ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t find PublishPress blocks in Gutenberg blocks’ is closed to new replies.