Template filters have to return the name of a template file, not content. Their purpose is to override template selection with a different template.
If you want to modify the content output within the content of a template, then you need to add a filter to the_content
.
function my_the_content_filter( $content ) {
global $post;
if ($post->post_type == "searchable-media"){
// your code to append your meta fields to $content
}
return $content;
}
add_filter( 'the_content', 'my_the_content_filter' );
Related Posts:
- Tips for using WordPress as a CMS? [closed]
- Custom Post Type Templates from Plugin Folder?
- Redesigning Custom Post Type “Add New” page
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Creating a default Custom Post Template that a Theme can override
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Getting Custom Post Type content from main-site of a Multisite
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- Custom comment type maybe?
- Twillio How To Send SMS for Custom Post Type
- Seriously stuck with some custom meta box/plugin stuff
- Enable comments for post with comments meta box removed
- [Plugin: Posts 2 Posts] reciprocal connections
- How to Build a Movie Library in WordPress 3.x
- How do I get multiple pages by title?
- I need to add a custom “cover” to every new post — plugin or custom setup?
- Star rating for custom post types [closed]
- How to Make a Custom Grid View
- Way to hook into a sidebar call to replace it with a custom sidebar
- How to get images from EDD post?
- wordpress reusable content blocks
- Allow users mark posts as “complete”?
- Is there a way to order posts and custom post types as one group?
- dynamically generating plugin syntax
- Duplicate posts when posting nulls in records in phpMyAdmin [closed]
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Accessing post’s meta data based on user’s click of a post
- Plugin custom post type – Internal server Error
- Exclude post by custom meta with pre_get_posts
- Is it possible to create Custom Post plug-in?
- get_post_type() and WP_QUERY issue
- List taxonomy terms for post as checkboxes
- Custom post type – no layout section of Document tab, and no author choice
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Keep a post copy when this one is updated – issue
- how to add a button next to the wordpress view button?
- ACF: post query, hide duplicate values [closed]
- What is the best way for showing a grid of customer logos?
- WordPress custom taxonomy not showing
- Using ACF default value to autoincrement a number field
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- posts from multiple post types in one slider
- Custom Post Type – custom form in dashboard
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- WP-API Custom Post Type json_no_route
- How can I list custom post type categories of portfolio
- How can I store data from custom fields to custom tables?
- Plugin generated unexpected output – No PHP errors
- “Allowed memory size” problem [closed]
- Use jQuery Datepicker code from plugin
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- “After file loaded” action
- Including content from legacy app: via plugin or custom content?
- Dictionary-style definition list plugin
- Custom Post Type, Custom Columns List
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Import Recent Posts Only and Ignore old ones if exist
- need click to clipboard button on my site
- WordPress REST API: Query media files attached to a custom post type
- How to get the custom field value using SQL query
- Setting Author on CPT
- Custom Post Type same name as Category
- Create category for each user
- Adding category base to url in custom post giving 404?
- How to display the category name in the tab and post inside the tab in WordPress?
- Want to build parent-child relationships between custom post types created with CPT UI
- custom post type plugin error [closed]
- How to display the custom post related blog by category?
- Undefined index: custom_post_template_present
- Add an action based on custom post meta field
- Problem with checked box on wp car manager plugin
- Merging new theme and plugins from development site to production
- Ultimate Members Default Post Layout problem
- $wpdb->insert not working inside save_post tag
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Calling an custom field from theme option at the frontend
- Array to string conversion error when trying to POST multidimensional array
- Creating themes using the one Plugin (Toolkit)
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- WordPress custom posttype meta values doesnot save
- making a glossary with wordpress
- Create custom fields on a post
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- get_option include in my adsense
- WordPress Custom post type won’t save properly
- Making a Custom Post Type Publish Loop
- WordPress User Frontend Editing Custom Fields
- Remove base from the custom post type URL [duplicate]
- Make a magic tag work with Custom Post Types
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- WordPress show different custom post type
- Links not opening as they should. Custom WP plugin
- How to make content as required in custom post type?
- How to provide page_template path in custom plugin using WordPress