The template_include
filter runs much earlier and is used to load the main requests template.
Your content will be called from within the_content()
, $GLOBALS['post']->post_content
or whatever you use to display it. Point is, that you can’t use the filter as it won’t trigger. Try to simply use something like require/include
.
Related Posts:
- Methods of Integrating Plugin Data with Themes
- How to include a page template and template part into my plugin
- A tool to analyze rewrite rules? [closed]
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Is get_option() faster than accessing get_transient()?
- How can I add a custom column to the “Manage Categories” table?
- Understanding WordPress functions’ naming conventions
- Using query_vars filter
- API to trigger prompt on leaving page
- Are shortcodes case-sensitive?
- Add content to widget title in admin area within the widget?
- Has anyone managed to integrate the wp_editor inside a widget?
- Using Primary Color in Plugin Block
- When is it appropriate to put functions on page template vs. functions.php?
- How to use the settings API to set multidimensional arrays
- Plugin to Consume a Web Service
- Copy Tags from one post type to another post type
- How to enable users to down-vote in this simple voting counter (that uses the post meta)?
- Multisite, sharing content by URL
- How to allow Unfiltered HTML in a wordpress multisite install
- Rewrite Point Doesn’t Work on Custom Taxonomy
- wp_remote_get keeps timing out
- How to Add Page Template from Plugin without Losing $this
- Backslashes being stripped from CSS
- Extending WP_List_Table seems getting wrong with $this->get_columns() – what’s wrong?
- Why doesn’t flush_rewrite_rules run on plugin activation?
- Finding posts containing matching array elements in a meta field usign WP_Query
- Should shorcodes in i18n plugins be translated and if so, how?
- how to use hook deleted_user into custom function to delete user from custom table
- Namespaced action and filter tags
- Adding Dropbox dropin js using wp_enqueue_script
- Show User’s Current Time
- Single sanitization callback for multiple fields
- How to filter users list on user_status field with get_users()
- Where did the ability to edit a plugin go?
- How to add custom fields to the all users page
- Can Page Templates be Applied to Archive and Post Templates?
- WooCommerce Admin Reports : Get custom product report based on date range
- Auto gallery from folder contents
- Append varible to url or set session
- Is there a plugin that will allow a tag cloud to be created from any mysql field?
- Adding custom end points, No error line
- Custom login doesn’t work properly
- automatic change post date when post is 30 days old
- Translate slug in WPMU with PO files
- Allow users to add / remove settings in plugin
- Update problem with update_option() in combination with register_setting()
- Custom Plugin theme filter
- Why does my widget break other widgets?
- Optimising a big WordPress site
- How do I link to a php file in my plugin directory?
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Is it possible to abort post update if specific conditions on metadata are met?
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- How to create a page with a form programmatically in WP?
- jQuery instantly executes (a button click and css change) on load
- Category select options for plugin settings
- why do I have to use required parametres?
- Plugin header: WP and PHP version control uses wp_die(), can I change that?
- How to make my shortcode load scripts and styles, from within the plugin?
- Completely isolate a plugin view so it doesn’t load the theme
- Does is_admin() really provide a plugin performance improvement?
- Enqueueing common php scripts in a plugin
- plugin content on front-page only. Nowhere else
- get_avatar filter in WordPress 4.4, how to filter properly
- How can I save a password securely as a settings field
- How to make a cronjob type plugin
- How to localize data array in plugin’s option page
- Update plugin settings option_name for big plugin update
- Changing permalink structure breaks link to .php file which generates files dynamically
- Decontruct serialized data array from wp_options
- Upload product image from frontside for administrator only
- $wpbd->insert_id is returning null
- Why does theme’s reset CSS have higher precedence of plugin’s CSS?
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- Plugin Activation Causes wp_register errors
- BuddyPress and namespacing
- How to get values from Tinymce visual editor popup?
- How to debug new shortcode? And how to get string from shortcode into code?
- Ajax call not working with
- plugin modal/popup integration best practice
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)
- how to display my WordPress plugin on a chosen page?
- Sessions in plugin development?
- Is it possible to make WordPress as a RESTful app?
- List all content by post type
- Best Way to Grab Post ID from Plugin
- How to set/change another post author by custom fields or something else?
- Fatal error: Call to a member function query() on a non-object in my ajaxpage
- Loop output for custom plugin [solution found]
- How to inject html to every page with a plugin?
- How to Pass ID through Short Code
- Custom plugin not appearing
- Gutenberg’s Popover component position relative to the focused element
- How to replace plugin icon?
- How to change the headline title for an admin page in a plugin?
- Cannot update plugin
- ACF – programmatically install and activate in pipeline to automate testing for custom plugin development?
- How can I include React useState in a custom gutenberg block plugin?