How to limit wordpress the_excerpt() dynamically

according to the documentation, it is more correct to change the length of the excerpt using add_filter: add_filter( ‘excerpt_length’, function(){ return 10; }); you can make your own function based on this, like this: add_filter( ‘excerpt_length’, ‘new_excerpt’, 10, 1); function new_excerpt( $lenth ){ return $length; }); … apply_filters( ‘excerpt_length’, 150 );

How to hide protected posts from archive?

There are 2 answers depending on where you want to do this. One has good news, the other has bad news Anywhere That Uses Post Queries Modifying the SQL is rarely necessary here and usually a sign that something was overlooked. In this case, WP_Query already provides a simple parameter to do this named has_password. … Read more