• Resolved amirhmoradi

    (@amirhmoradi)


    Hi,
    Thanks for the great plugin.

    In my PHP Snippet, I use ‘<script>’ tags for output, but these tags get stripped away after the first successful execution of the snippet.

    Here is the code before execution:

    
    // ...
    $response = wp_remote_post( 'https://example.com/my_api', $args );
    $json_in_body_data = wp_remote_retrieve_body($response);
    return '<script>var examplevariable = '. $json_in_body_data . ';</script>';
    

    After the first (successful) execution, the code snippet gets modified automatically to:

    
    // ...
    $response = wp_remote_post( 'https://example.com/my_api', $args );
    $json_in_body_data = wp_remote_retrieve_body($response);
    return 'var examplevariable = '. $json_in_body_data . ';';
    

    Note the <script> tags being removed.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @amirhmoradi,

    That’s very weird, the snippet should not be updated in any way by the execution, the only possible scenario I can think of is if the snippet gets automatically deactivated due to causing a fatal error, but even then, the code should not be modified in any way.

    I tried the example code you sent on my end and I can’t replicate the script tags being stripped.

    Is it possible that there’s another plugin that you have on your site that might interfere with the way the code is stored? (stripping tags)

    If you simply save the snippet without activating does the script tag removal still happen?

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Script tags removed from PHP Snippet’ is closed to new replies.