• Need to execute two different php_everywhere code blocks.

    Tried implementing the method in the documentation:

    [php_everywhere instance=1]
    [php_everywhere instance=2]
    .
    .
    .
    <?PHP if ($instance==”1″) { … }
    else { … }

    But this causes a WP fatal error on the page.

    Wordpress v5.5, PHP v7.4

Viewing 5 replies - 1 through 5 (of 5 total)
  • This goes into the php everywhere code box:

    <?php

    if($instance==”1″)
    {…}

    if($instance==”2″)
    {…}
    ?>

    This goes into the page’s html:

    [php_everywhere instance=1]
    [php_everywhere instance=2]

    Works for me like that.
    Not sure about using “else”
    Make sure you close php tag.

    Thread Starter nerdjohn

    (@nerdjohn)

    That’s the original construct I used… upon saving the WP page, it threw an error; every attempt to access that page resulted in WP crashing.

    FYI, the IF statements in the php_everywhere box were simple INCLUDE statements.

    Would be better if you shared your code.
    When did you get the error? was it working before?

    A few possible pointers:

    Check php 7.4 changelog and compare with your code. Maybe a legacy command is the culprit.

    Check the console and see if there are any errors in there.

    Try debugging by simplifying and running your code one chunk at a time and see at what stage it throws an error.

    Thread Starter nerdjohn

    (@nerdjohn)

    Here’s the error:

    Updating failed. The response is not a valid JSON response.

    I suspect Gutenberg editor.
    Try switching back to classic editor.

    I am using “Disable Gutenberg plugin”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issues with Multiple Instances’ is closed to new replies.