• I define max description to 150 characters. Sometimes, the post didn’t insert into database

    $excerpt = html_entity_decode(substr(strip_tags($job[‘job_description’]), 0, 150) . “…”);

    When I change max lenght to 140 , it’is works . any idea for this problem please

    • This topic was modified 2 years, 9 months ago by aliceevra.
    • This topic was modified 2 years, 9 months ago by aliceevra.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s probably the nature of the content being trimmed more than the length. Maybe some unacceptable characters sneaked in? Likely in the last 10 chars of the result.

    Try using wp_trim_excerpt() instead. It defaults to 55 char length, but you can alter that to be 150 through the “excerpt_length” filter. It does a good job of stripping tags and things that don’t belong in the resulting excerpt.

Viewing 1 replies (of 1 total)
  • The topic ‘problem insert post type’ is closed to new replies.