[wp-hackers] wp-hackers Digest, Vol 102, Issue 5

Jacob Snyder jacobsnyder at gmail.com
Thu Jul 4 13:27:52 UTC 2013


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.

On Thu, Jul 4, 2013 at 7:00 AM, <wp-hackers-request at lists.automattic.com>wrote:

> Send wp-hackers mailing list submissions to
>         wp-hackers at lists.automattic.com
>
> 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
>         wp-hackers-request at lists.automattic.com
>
> You can reach the person managing the list at
>         wp-hackers-owner at lists.automattic.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of wp-hackers digest..."
>
>
> Today's Topics:
>
>    1. Ignore filtered_html (Dobri)
>    2. Re: Ignore filtered_html (Nicholas Ciske)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 3 Jul 2013 10:37:40 -0400
> From: Dobri <dyordan1 at ramapo.edu>
> To: "Discussion list for WordPress developers."
>         <wp-hackers at lists.automattic.com>
> Subject: [wp-hackers] Ignore filtered_html
> Message-ID: <9D1D6608-D813-4046-B7B6-C4EAD86EFDD1 at ramapo.edu>
> 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
> From: Nicholas Ciske <nl at thoughtrefinery.com>
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] Ignore filtered_html
> Message-ID: <B604B143-BFE8-4630-9121-BD186DEACD31 at thoughtrefinery.com>
> 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?
>
> If you want to use the content editor, this may be what you're looking for:
>
> 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
>
> On Jul 3, 2013, at 9:37 AM, Dobri wrote:
>
> > 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
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
> ------------------------------
>
> End of wp-hackers Digest, Vol 102, Issue 5
> ******************************************
>


More information about the wp-hackers mailing list