A more reliable way would be to filter the excerpt and to explode the string into an array, remove the first two key/value pairs from the array and then return your string
add_filter( 'wp_trim_excerpt', function ( $text )
{
// Make sure we have a text
if ( !$text )
return $text;
$text = ltrim( $text );
$text_as_array = explode( ' ', $text );
// Make sure we have at least X amount of words as an array
if ( 10 > count( $text_as_array ) )
return $text;
$text_array_to_keep = array_slice( $text_as_array, 2 );
$text_as_string = implode( ' ', $text_array_to_keep );
$text = $text_as_string;
return $text;
}):
Related Posts:
- Best Practice for PHP
- retrieve thumbnail from post ID of best selling product in category
- How to create a WP_Query to search the Title or Tag?
- Limit the Excerpt field in WP-Admin in words
- how to display active, upcoming and past event with featured listing with pagination
- if statement on database query
- Duplicates with WP_Query loop
- WP_Query meta_query results date by date
- Extremely slow pageload for long post when using the_content?
- Help with adding pagination to custom wp_query
- How do I dynamically generate args for wp_query?
- API response to be stored locally
- Use wp_get_recent_posts with search term
- have_posts() execution failure
- How to filter posts by post format “standard” from wp-json api?
- Can’t search posts using WP_QUERY inside AJAX Function
- How can I use wp_query to show all product data using just the products ID?
- How do I Add HTML to the_excerpt() & the_content() Output?
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How to store post ID’s in cookie or session to display the same posts later
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- HTML tags not showing in excerpt
- auto-populating custom nav with all items from custom post type
- WordPress theme options error
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Using the_excerpt() on a page
- Get posts from multiple post type
- WP_Query fails despite having 1 post
- Create a Blog Template Page
- wp_query get the 2nd post
- Exclude posts with specific metadata from search?
- Display an image if odd number of posts in grid
- How to add div blocks after certain set of post
- Why doesn’t PhotoSmash plugin play well with wp_query?
- the_posts_pagination() not working in wpquery
- WP_Query: getting posts where custom field exists
- How to show meta value code HTML after x paragraph
- Form search query – displaying ACF “Post Object” field as results
- get_the_ID() doesnt work
- Custom route and query
- change the default order of posts only for specific categories
- Getting posts to exclude from array
- Custom post type permalinks do not appear using the link functions
- Modify main query before it run without pre_get_post
- How can I split my query result in 2 arrays?
- array_rand not working correctly?
- WP_Query() load selected post
- How to get post category list as select in front-end?
- Order a WP_Query by meta value where the value is an array
- How do I check if there is a tag in the title
- Post class only applying to first excerpt; why?
- How to extract information from a wp_query result?
- Assign Custom classes to every Excerpt
- Using multiple variables to assign categories to an array
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- orderby meta_value_num is not working, giving default order
- How can I modify this code to make the search box include tags and meta
- WP_Query for woocommerce products with a pattern as a post_title
- WordPress Search Ajax + Isotope + InfiniteScroll
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Sending simple variable on single page to WP JSON
- How to call my PHP function with AJAX ? wp_query
- Ajax filter with loadmore button
- Query by pagename not Working
- Display featured image of post type category
- Delete post meta by serialized meta value
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- Getting info about selected posts using one WP_Query
- Cannot figure out how to add a read more link to a manual excerpt. Please help
- WP_Query To Display Product Of Brand On Taxonomy Page
- How to display last whole post on the homepage
- How to return count of items found in SQL query
- wp_query beginner
- Add point on excerpt post
- For each 3 posts, show a different post type
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WooCommerce – Print Processing orders [closed]
- Weird Behaviour: Not all WordPress Posts appearing
- List of child pages fetch next results at link click
- Query category-specific, paginated posts and allow viewer to change sort order
- wordpress is_main_query() breaks
- allow previews outside wordpress folder (Outsourcing WP previews)
- How to get category pages to look like a certain archive page?
- Creating a function that sanitizes the custom metabox excerpt
- Post Title Not showing up
- Advanced Taxonomy query, with 3 post types
- reorder a WP_Query, using a dropdown
- Custom query_posts() parameter
- Why does a meta_query break this WP_Query?
- I can’t seem to get excerpts showing inside get_pages and don’t know why?
- How to modify this function to exclude also the post belonging to a specific category?
- Display biography post for today’s birthday person
- How to sort custom sortable column by custom table value
- /page/2/ redirect to 404
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false