• Resolved gnjang

    (@gnjang)


    <script>
    <!-- -->
    The relevant tags are changed or deleted and the post is saved.
    
    Is there any way to prevent this?
    
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • define( 'DISALLOW_UNFILTERED_HTML', true );
    

    in wp-config.php is the recommended way to do this.

    Moderator bcworkz

    (@bcworkz)

    If you were to prevent inline scripts from being removed from post content there is still a significant risk that the various applied filters will corrupt your code. To reliably insert inline script you either need a custom block, custom shortcode, or use an appropriate action hook to output your code.

    Thread Starter gnjang

    (@gnjang)

    I understand the script, but is there any other way to delete HTML <!– comments?

    Thread Starter gnjang

    (@gnjang)

    I would like to know if there is any hooking method so that when an account designated as a general administrator, not a super administrator, edits a post, all posts are replaced.

    Moderator bcworkz

    (@bcworkz)

    It’s feasible to strip out comments through “the_content” filter, but don’t remove all comments, some are used by the block editor.

    when an account … edits a post, all posts are replaced.

    That sounds undesirable to me. If I’m an admin who edits a post, you want that post to replace all other posts??? Resulting in all the various posts having the exact same content? What purpose would that serve? Or do you mean what ever the edit is, to globally apply the same edit to all other content without altering unaffected content? For example, if I change “color” in a post to “colour”, all other instances of “color” ought to also be updated without affecting other post content.

    Thread Starter gnjang

    (@gnjang)

    I want to prevent tags like <!– from being changed to &gt ,lt .

    Moderator bcworkz

    (@bcworkz)

    This behavior is in normal post content? Comment delimiters should not be converted to HTML entities like that. That would cause the comment to become visible to visitors as plain text. This undesirable conversion is not due to core WP. It would have to be due to one of your plugins or your theme. Isolate the cause by selectively deactivating plugins or switching to a default Twenty* theme. Test after each change.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Why remotve script tag when admin edit post’ is closed to new replies.