Here’s what I’m doing:
I have written a script that protects posts from un-authorized users. Now when someone goes to a category where all posts in that category are protected , I create a “fake” (temporary) post (shown further below) that puts a custom HTML error message into the $post->$post_content, and return that back to WordPress.
PROBLEM: The custom error message displays fine in the two older “default” WP themes, even in the copyblogger theme. But when I switch to the “TwentyTen” theme or “Thesis”, then all HTML gets stripped out from the error message, and only the “text” portions of the error message can be seen in the browser (all img, href, p tags are gone).
Have been breaking my head for over 3 days, and finally decided to ask for help.
NOTE: Tried this on WP 3.0.1, 3.0.2, 3.0.3, and even 3.1 (beta 1 & 2). Same problem with all versions.
Here’s the code I’m using to create the “fake” post:
$post = new stdClass; $post->ID = -1; $post->post_author = 1; $post->post_name = "temporary-post"; $post->guid = get_bloginfo('wpurl'); $post->post_title = "Protected Content"; $post->post_content = $customHTMLMessage; $post->post_status = 'static'; $post->comment_status = 'closed'; $post->comment_count = 0; $post->post_date = current_time('mysql'); $post->post_date_gmt = current_time('mysql', 1); $post->post_category = array(0);
Thanks in advance for your help!
- The topic ‘Some themes stripping out HTML from $post->$post_content’ is closed to new replies.