Title: Set character limit in the query_posts function?
Last modified: August 18, 2016

---

# Set character limit in the query_posts function?

 *  [Darren](https://wordpress.org/support/users/cutout/)
 * (@cutout)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/)
 * On the front page of my site, I’m pulling in the latest blog post like this:
 * `<?php query_posts('showposts=1'); ?>`
 * I only want to pull in the first 100 words, though. Is there a parameter for 
   this?

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545060)
 * You can display the first 100 words, but I think you’ll have to get the whole
   post + meta + comment count, etc. (if you want to use them).
 *  Thread Starter [Darren](https://wordpress.org/support/users/cutout/)
 * (@cutout)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545115)
 * How do I set the parameter for number of characters?
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545184)
 * Try using “the_excerpt()” instead of “the_content()” in the loop.
 *  Thread Starter [Darren](https://wordpress.org/support/users/cutout/)
 * (@cutout)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545212)
 * Excellent! Thanks for the suggestion. I’m pulling in the excerpt, but WP is automatically
   wrapping it in a paragraph tag. Any way around this?
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545213)
 * Easiest is in the css:
    “reference to the container” `p {margin:0;padding:0;}`
 *  Thread Starter [Darren](https://wordpress.org/support/users/cutout/)
 * (@cutout)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545235)
 * Unfortunately, the excerpt bit occurs within a `<span>`. Putting a block element(
   p) inside the span breaks validation regardless of the padding or margins. Any
   way to hack into the WP core files and delete the paragraph tag altogether?
 *  [Andrew Ozz](https://wordpress.org/support/users/azaozz/)
 * (@azaozz)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545253)
 * There’s a plugin, disable wpautop (or similar). May break something else…
 *  Thread Starter [Darren](https://wordpress.org/support/users/cutout/)
 * (@cutout)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545257)
 * I’ve actually got that plugin. I’ve turned it on and off, but no dice.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Set character limit in the query_posts function?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Darren](https://wordpress.org/support/users/cutout/)
 * Last activity: [19 years, 1 month ago](https://wordpress.org/support/topic/set-character-limit-in-the-query_posts-function/#post-545257)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
