Discussion:
wp-hackers Digest, Vol 102, Issue 5
Jacob Snyder
2013-07-04 13:27:52 UTC
Permalink
You could plug into the
save_post<http://codex.wordpress.org/Plugin_API/Action_Reference/save_post>action.

if ( 'snippet_type' == $_POST['post_type'] ) // save
$post->post_content however you want

Of course, you are resaving it over the html_filtered save that just
happened, but you could control it. Maybe there is a better action, but the
meta field idea isn't a bad idea.
Send wp-hackers mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.automattic.com/mailman/listinfo/wp-hackers
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of wp-hackers digest..."
1. Ignore filtered_html (Dobri)
2. Re: Ignore filtered_html (Nicholas Ciske)
----------------------------------------------------------------------
Message: 1
Date: Wed, 3 Jul 2013 10:37:40 -0400
To: "Discussion list for WordPress developers."
Subject: [wp-hackers] Ignore filtered_html
Content-Type: text/plain; charset=us-ascii
Hi,
I'm working on a plugin for WordPress that adds Code Snippets. Brief
overview: admin people create/edit the code snippets and then when an
editor wants to include them on a page, they use a shortcode. However, I
want to make sure that when the code snippet(which is just a post type) is
being saved, no html filtering is done. My guess is it will be done with
kses_remove_filters(). I'm having trouble hooking to the right place
though. So, what would be a good hook to check that WP is currently saving,
check it's my custom post type and be early enough to run
kses_remove_filters()? Is content_save_pre with priority < 10 a good
choice. I do get the content and I guess it's early enough to run kses...
but can I check the post_type? Any other ideas? Thanks!
Dobromir Yordanov (Dobri)
Web Developer & WordPress Support Specialist
Ramapo College Web Team
Phone: (201) 684-6657
~Dobri
------------------------------
Message: 2
Date: Wed, 3 Jul 2013 10:39:05 -0500
Subject: Re: [wp-hackers] Ignore filtered_html
Content-Type: text/plain; charset=us-ascii
Use a meta box/custom field (i.e. turn off post_content in your CPT) and
you can control how it's saved.
As it's a code snippet I imagine a true code editor like code mirror would
be preferable over the standard html editor in WP?
http://wordpress.stackexchange.com/questions/75568/wp-insert-post-disable-html-filter
Also note that there is a capability called unfiltered_html that has a
bearing on whether or not HTML is filtered by default.
_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
I'm working on a plugin for WordPress that adds Code Snippets. Brief
overview: admin people create/edit the code snippets and then when an
editor wants to include them on a page, they use a shortcode. However, I
want to make sure that when the code snippet(which is just a post type) is
being saved, no html filtering is done.
~Dobri
------------------------------
Subject: Digest Footer
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
------------------------------
End of wp-hackers Digest, Vol 102, Issue 5
******************************************
Loading...