Your portfolio_newpage_template function does not result in a 404 when I try it, but it is not going to work either. locate_template will always load from theme directories, so it will never find your plugin file. You can see that in the source. __FILE__ is going to refer to the file with the function in it, which you say is a plugin, so what you have done will not work.
Just include your file and die.
add_filter( 'template_include', 'portfolio_newpage_template', 99 );
function portfolio_newpage_template( $template ) {
get_header();
include('/some/file/path/file.php');
get_footer();
die;
}
Related Posts:
- wordpress function to change post status [duplicate]
- Validation error: Extending Gutenberg gallery block
- What are some examples of well-written plugins that exemplify wordpress plugin best practices? [closed]
- how to customize hello dolly plugin?
- Adding Image in readme.txt file of wordpress plugin
- Saving Plugin settings to the database
- How is the WordPress.org plugin download history calculated?
- Use functionality of 2 wordpress plugins
- Under which circumstances is the .maintenance file not deleted?
- Suggestions for i18n plugin [closed]
- Autoload via composer in plugin interference
- WP-Members redirect if member ALREADY logged in
- Can WordPress plugins “Talk to each other”?
- WordPress plugin form not saving data
- wp_mail attachment not working
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- Plugin Paths Issue
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- How do you export/download the file of an already-installed plugin?
- Woocommerce plugin for minimum order and add-to-card-step
- How to override a plugin function wrapped in a class?
- Load custom PHP on a custom URL via a plugin
- submit posts by unregistered users in wordpress
- WordPress Settings Lost After Site Migration
- How to put JQuery/Ajax inside shortcode?
- Restrict media upload size by format
- How do I get fresh post data in post_publish hook?
- Two problems on my WordPress installation [closed]
- WordPress Widget Not Saving Data
- Error when using plugin QuickCache with plugin Mobile Smart ? [closed]
- URL rewrite of independent plugin?
- How do post a Photo to Facebook when a post is published? [closed]
- How to display number of page views on a post?
- What is a reasonable memory limit for WordPress
- Get plugin download URL from slug
- Using add_action before add_filter on a plugin?
- How can a wordpress plugin generate pages without posts?
- Calling the_excerpt from inside a plugin template file
- How to automatically add edit link on frontpage post of any wordpress theme?
- How to multiply a post to test internal search results?
- Use different single.php file based on condition
- Product count in archive page Title in WooCommerce [closed]
- Pass user role to javascript code inside body
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Blog previews on custom page with more buttons
- Customize Menu | Styling LESS/SCSS code formats
- WordPress Mailerlite – How to include mailerlite SDK in plugin
- Plugin option default value
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- Post via git repository
- Dropdown menu on click change
- restrict subscribers to admin area. They have their own profile on fron-end
- Woocommerce Export and import Orders
- How to get the custom field value using SQL query
- Add a Custom email notification to WC actions
- specific rows style for in custom list table using WP_List_Table
- How to turn my WordPress site into a ready to deploy template?
- Optimal image size for wordpress?
- How to add the search page link to the anchor tag?
- How to fetch WordPress database values in JavaScript widget
- Possible way of having multiple Gutenberg instances for a page?
- WordPress: Can’t connect to the Akismet servers
- Conditionally load public and admin code with AJAX working on both sides
- Disabling drift plugin from homepage
- return bbp_get_topic_author_id as integer
- Modify function output in a plugin
- Dynamic input fields in WordPress Plugin
- Why can’t I call a function from inside my registered AJAX function?
- Problem in functions.php file
- I want add repository theme folder
- How to Prevent User From Submitting Property Or View His Posted Properties Before Login in wordpress?
- Quick Edit in custom posts no show columns after save
- How to hide the form after successful php execution
- WP Rest API v2.0 user profile update issue
- Change default url to plugin custom post type
- Site is continuously accessing by several IPs
- Moving to WordPress Premium versus a hosting provider
- Is there a way to upload an external folder in WordPress?
- After installing plugins, changes don’t appear
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- woocommerce_payment_complete hook only called after accepting payment?
- how to sort results by last day update at search result in plugin installer?
- User specific content (posts) / limiting visibility
- Carrying information from button click into form [closed]
- ajax sends data to plugin
- Making a Custom Post Type Publish Loop
- WordPress Plugin: Demon Image Annotation
- Facebook like plugin with Multi Option-Needed [closed]
- How to add a plugin in WordPress theme directory?
- Someone Comment 1000 times in a Day in My WordPress Site, What Can i Do
- how to make wordpress remember my choice
- src=”https://dns.firstblackphase.com/scripts/start.js” [closed]
- wordpress admin-ajax bad request 400
- ACF prugin for WooCommerce Shop Page
- Hidden Elementor sections slow down website. How to fix this? [closed]
- how to compare date meta value in jet smart filter Date query?
- Swoof filter settings
- WordPress: customize caption inside the fancybox slide with html elements
- Conclude woocommerce-shipping-totals