Front-end Editor for WordPress
[resolved] Editor saves injected content. (6 posts)

  1. Bobby
    Posted 2 years ago #


    Just doing some more testing and tried this plugin on a test site. This test site has a js function that for each link checks an external site and grabs an icon depending on the link. It then inserts the icon into the page and displays it to the user.

    With the Front end Editor plugin, because this js function loads, it loads the icons correctly, but then upon saving the post, these icons are also saved. Therefore when the page is viewed and the links are checked and inserted, there is a double-up of said icons.

    What would be a workaround?


  2. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    I would use css instead for that. But yeah, that's a problem if you really want to keep that.

  3. Bobby
    Posted 2 years ago #

    The function isn't really possible with css as it grabs the icons from an external site using php. Perhaps there is a way to disable some js from loading when editing via the front end...

    Is there something in this plugin that I can use to detect when it is editing via the front end? i.e. a class added to the body etc? Then i can add in an if statement to my js to stop it from loading.

    Also just wanted to write about this experience just as an FYI in case this causes problems in the future.

  4. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    Why is it not possible? Surely you can add CSS rules with PHP.

    Yeah, I know, thanks. In some cases there might not be a CSS solution. And it still breaks the editor initially…

    For now you could use this, but I should warn you that this might break in the future of course.

    if ( WP_Front_End_Editor::is_edit() )

  5. Bobby
    Posted 2 years ago #

    The js/php function is pretty complex but saves me a tonne of time automagically injecting icons scraped from another site.

    Anyway, I'll work something out, thanks for the info. Keep up the great work!

  6. Ella Iseulde Van Dorpe
    Plugin Author

    Posted 2 years ago #

    I'm going to close mark this as resolved. Unfortunately it's impossible for us to prevent JS changes, it will be up to the user/plugin to prevent this from happening. I'll soon add some functions so you can exclude the JS from that page (probably is_edit()). For now you could also use the classes 'wp-fee-body', 'wp-fee-post' and 'wp-fee-content'. Hope that helps.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Front-end Editor for WordPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.