As stated in the docs, if the quicktag <!--more-->
is used in a post to designate the “cut-off” point for the post to be excerpted, the_content()
tag will only show the excerpt up to the <!--more-->
quicktag point on non-single/non-permalink post pages.
WordPress adds <span id="more-' . $post->ID . '"></span>
to the content in this case. Since there’s no content in the <span>
(check out the code), you can easily remove the <span>
by filtering the content:
add_filter( 'the_content', function( $content ) {
return str_replace( '<span id="more-' . get_the_ID() . '"></span>', '', $content );
}
Note that this causes the Read More link not to jump to the area where you inserted <!--more-->
anymore. An easier way to achieve this would be to use the the_content_more_link
filter and remove the #more-<post_id>
part from it there. There are a few examples in the Codex for that.
Related Posts:
- A special single page templates for posts under a category and all its child category
- Remove post templates from the selection box menu when creating a single post
- global variables in templates
- how can I add a “read more” tag directly in the template?
- How can I include ALL post types in the_post_navigation() links, not just current post type?
- Two different single.php depending on source page
- Search button click sends to single-custom_post_type instead staying at the same page
- Page Templates Used in Custom Post Type
- Single template will not show sidebar/bottom-nav and footer
- Read more button not working
- Custom Post Type Trouble
- Adding Page Attributes Metabox and Page Templates to the Posts Edit Page?
- Print WordPress template filename(s) for debugging
- Change the name of the ‘Default Template’
- Echoing Elementor page content in template, but it doesn’t get styles and some widgets are missing
- How can I modify the default reset (lost) password email text?
- Template files missing after moving site
- Create single.php for specific category by category id
- Grid layout “last” class to every third item
- How do you modify Page Template?
- Using “setup_postdata” with “get_template_part” does not work
- How can I get the content of the home page?
- Why aren’t my posts showing?
- How to display error on specific template?
- How to move style from template file to section?
- What is content.php file that is needed for Jetpack infinite scroll plugin?
- Auto-Generate Longtail-SEO Pages/URLs
- bloginfo(‘template_directory’) img src
- Should template files be copied to the child theme for editing?
- Calling an image within the theme folder from inside a post/page?
- Best Constant to use to check if WordPress is running
- Do not show excerpt in post content
- WordPress automatically created files like .theme-name / .plugin-name.php [closed]
- How to show the archive / post type description on Single templates
- WordPress editable template fields
- Conditionally display different images before the content in a page template
- One of my pages uses the archive.php template only. Why?
- Why are 404s not triggering my 404.php template?
- Is there a way to create a block template that is not limited to a post type?
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- link to non-category page routed to category template
- Can’t format content of Rich Text Editor in Template
- get_file_data to read data for Custom Template File?
- Footer.php not showing?
- How to publish a Page and Posts using single template
- lost css when overriding themes templates
- What is the best practice to style archive page 2,3,etc differently than archive.php?
- How to create a post template with two sidebars
- ACF costum date format [closed]
- != and !== both not always working? [closed]
- Page template for a site from network
- WordPress 3.3.1 single post template
- Conditional to determine if search.php page is the current template
- Prevent 404 and serve custom template for custom URL
- Page Templates not using functions.php
- Add stylesheet per layout
- Load different single.php templates according to post layout selection
- use a custom page to display search results
- When a user registers, create a page from an existing template with their username as the page name
- Theme settings Page: Settings Api vs Update_Options
- How to add description over forum list on bbpress root page
- two active templates for one post
- Where is the code for “Front Page Template”?
- Help Understanding Template Hierarchy
- what is template-name.php
- templates with page teasers Or Featured Items
- If Child or Grandchild of Page
- Page template not registering on theme
- Function to allow single post template based on custom taxonomy?
- Is it possible to create custom links inside a template?
- How do I custom a page that doesn’t exist in the page list?
- Uncaught Error: Call to undefined function twentytwenty_the_post_meta()
- Timber + MtHaml, or any other HAML-like HTML shorthand
- small problem in the article ()
- Unable to access wordpress page
- How to configure my blog page
- BuddyPress : how can I call the template WordPress would have chosen (template hierarchy)?
- How can I make custom page templates work on child theme?
- Assign for all post of a post type a specific single-post template
- Archive only for /year/month, not terms
- Why default template does not show?
- Why does the blog page not take the page template selected?
- Custom Taxonomy Theme file not routing correctly
- Why would adding a template file to a child theme cause an error in template-loader.php?
- How can I make is_page_template() workable in child theme?
- How can I add some blocks to template without changing template file?
- Creating a popup
- WordPress not picking up custom templates in sub directory
- Category template not displaying all post formats
- Mysterious template change after database import/export
- Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?
- Styling own template
- WordPress sites translate dynamically generated Homepages
- changes to templates not showing on server
- Why is this page using the homepage template and not the one it should?
- Problem with permalink structure for WordPress custom post_type archive template
- Make default template two columns?
- pass dynamic value to page to pull in categorised post cards
- templates page not showing on gutenberg editor
- How to load php templates from html page (block theme)