Posted By

rolandog on 11/12/08


Tagged

wordpress rm remove wp autop wpautop


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Who likes this?

1 person has marked this snippet as a favorite

rolandog


rm_wpautop


Published in: PHP 






URL: http://rolandog.com/archives/2008/11/12/wp-plugin-rm-wpautop/

Expand | Embed | Plain Text
  1. <?php
  2. /*
  3. Plugin Name: rm_wpautop
  4. Plugin URI: http://rolandog.com/archives/2008/11/12/wp-plugin-rm-wpautop/
  5. Description: This plugin allows you to remove the wpautop filter by placing a 'wpautop' custom field with a key value of 'false' in your pages or posts, therefore allowing WordPress not to automatically add paragraph or break elements.
  6. Author: Rolando Garza
  7. Author URI: http://rolandog.com/
  8. Version: 0.3
  9. */
  10. function rm_wpautop($content) {
  11. global $post;
  12. // Get the keys and values of the custom fields:
  13. $rmwpautop = get_post_meta($post->ID, 'wpautop', true);
  14. // Remove the filter
  15. remove_filter('the_content', 'wpautop');
  16. if ('false' === $rmwpautop) {
  17. } else {
  18. // Adds the filter again, if not set to false.
  19. add_filter('the_content', 'wpautop');
  20. }
  21. return $content;
  22. }
  23. // Hook into the Plugin API
  24. add_filter('the_content', 'rm_wpautop', 9);
  25. ?>

Report this snippet 

You need to login to post a comment.