• Resolved emirpprime

    (@emirpprime)


    I have set remove_filter('the_content', 'wpautop'); in my functions.php and that works for my posts and pages. However my Simple FIelds HTML Editor content seems to be running wpautop still. Certainly I am getting <br/> and <p> inserted where I don’t want them… Is there a hook to use to remove this?

    I’ve actually found the code: Line 357 in function_post.php. Setting $do_wpautop to false solve it. However editing the plugin is a bad idea long term. Does anyone know of a “safe” way to do this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Even I’m looking for a solution to this. My copy of Simple Fields doesn’t even have function_post.php and there’s nothing useful on line 357 of just functions.php

    Thread Starter emirpprime

    (@emirpprime)

    Yeah Simple Fields has gone through a lot of changes since that hack. I don’t find I need to modify the plugin anymore. But I do have wpautop modified using functions.php (in my theme that is, nothing to do with the plugin).

    /*Remove Auto <p> filter then re-add with lower priority so runs after shortcodes*/
    /*This prevents annoying <br/> / <p> insertions in shortcode contents*/
    remove_filter( 'the_content', 'wpautop' );
    add_filter( 'the_content', 'wpautop' , 98); //98 so runs after everything else, except function to stop iamges getting wrapped in <p> (very below)

    Might help you – if not / anyway the developer might get in touch and can probably be more help.

    Thread Starter emirpprime

    (@emirpprime)

    Sorry – posted in haste – on the last line of that ignore everything after the word else.

    Basically I just remove the wpautop, then re-enable it but setting the priority to a greater number than default, this makes it run later in the process and prevents lots of problems (for me, ymmv).

    I found your blog post about this just moments after I posted in here, but that solution doesn’t seem to have worked for me. I’m still getting extra Ps and BRs in my code and my problem is a bit worse because the actual contents of the fields are modified and saved, not just wpautop’d during run time.

    I can’t find any solution other than displaying the fields as plaintext textareas instead of HTML ones, which means the CMS users will have to learn code to edit!

    Thread Starter emirpprime

    (@emirpprime)

    In case you haven’t seen it you could also try raising an issue over on Github – https://github.com/bonny/WordPress-Simple-Fields

    Definitely not cool that it’s getting sent to the database – wpautop shouldn’t do that so there is something wrong there.

    You sound like you have it covered but it’s always worth (backing up, then working on a duplicate site ideally) disabling all other plugins, switching to Twenty Ten / Eleven / Twelve theme, and checking if the problem is still there. That’s normally the first step to nail it down to a specific plugin rather than a theme / plugin conflict.

    Good luck!

    Thread Starter emirpprime

    (@emirpprime)

    This is a PITA… this problem just re-appeared for me.

    I’ve gone back to hacking the plugin to make it go away. Line 449 in simple_fields.php – just comment it out.

    wpautop() is run by core on output – so I don’t know why it is needed here as it is being run on save/update. This means it ends up in the database which isn’t the idea of wpautop().
    In my quick tests (clean install, no other plugins) just inserting “standard” content like images, headers, paragraphs etc, I found no reason to need wpautop() to run at that stage. The Visual editor even strips out the tags that it inserts.

    YMMV.

    I’d love to hear from the developer about this as to whether he knows there is a definite case / reason to run it. Otherwise I hope it gets removed in a future version.

    Still a great plugin – just a niggle.

    Thread Starter emirpprime

    (@emirpprime)

    Not sure if you’re still reading this aalaap – but just had confirmation that the author has added a filter to disable wpautop in the new version about to be released ??
    https://github.com/bonny/WordPress-Simple-Fields/issues/9

    Sounds great! I had to make do with the old version by using plain text, but I’m going to use the new version in a new project and I’m hoping things go better then! Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Simple Fields] remove wpautop’ is closed to new replies.