SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: cleaning posts

  1. #1
    SitePoint Member
    Join Date
    May 2012
    Location
    Lancaster, KY
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question cleaning posts

    I posted this on the WP forum, so far to no avail. I'm pretty stuck, so any help is greatly appreciated.

    I'm creating a site using WP for my CMS...not necessarily creating an entire theme, but just using WP to allow the customer to make text changes. When I go to display a single post, it gives me all kinds of strange characters. For example, a space bar comes out as . Is there a default WP function to call that will clean this up from SQL? I've searched high and low, and I guess I do not know the correct wording for this problem.

    Here's what I am currently using to display a single post in PHP:

    Code:
       $post_id = 19;
       $queried_post = get_post($post_id);
       $content = $queried_post->post_content;
       $content = apply_filters('the_content', $content);
       $content = str_replace(']]>', ']]>', $content);
       echo $content;

  2. #2
    SitePoint Member
    Join Date
    May 2012
    Location
    Lancaster, KY
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to follow up, the code here was fine, my problem was with a different portion of the page interfering.

  3. #3
    SitePoint Addict
    Join Date
    Apr 2012
    Location
    Delhi
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess your database is corrupted and you need to refresh it. Reload all the data in your CMS and see if the problem is resolved. I'm not aware of any default function in WP which can set things right for you. The reloading of content might help you out.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •