Use is_page()
. The is_page()
function accepts page title, slug or id. Documentation
<?php
if(is_page('myscript')) {
include '/path/to/myscript.php';
}
?>
UPDATE
To add it to the content, you have two options
1. Find the content function in your template
Find either the_content()
or get_the_content()
in your template. Place it immediately after that function (or before if you want it before).
2. Add A Filter
Move the above code into your theme’s functions.php
file and wrap it in a function. Then add a filter to the_content()
to make it include your new function. Your code should look something like this:
function my_the_content_filter(){
if(is_page('myscript')) {
include '/path/to/myscript.php';
}
}
add_filter( 'the_content', 'my_the_content_filter' );
Related Posts:
- How to call a plugin function from index.php
- Rewriting every url
- Change post permalink to external URL from custom field
- Prevent page slug from interfering with custom post type archive permalink?
- Passing URL parameters to WordPress pages and pretty url
- Change Permalinks Structure to a Sequential Number for Each Post?
- Publish Post After Click On A Link
- How to prefix `attachment` permalinks with `attachment`?
- Alter post slug by a filter that is fired just after a post is created
- How to get the custom page get_permalink?
- How to set “with_front’=>false” to a plugin-generated cpt?
- WP get_permalink Return Wrong URL
- How to add nofollow on all external links without plugin?
- Custom url structure for custom template
- Add a Custom Permalink option in the Permalink Admin Screen?
- Social sharing post’s shortlink instead of permalink
- How to get the permalink of a page when loading my plugin
- Mixed unrelated taxonomy in permalink
- Rewrite url without flushing the database?
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Changed permalink structure. Need help with redirecting old posts
- Change permalink structure hidden button edit
- How to change custom post type pemalink Hierarcy
- resetting permalinks after changing page names
- Plugin appends ugly URL string to index
- How to make a proper custom post type link
- Pagination Broken on Static Pages but Works on Blog Articles
- AddToAny shortcode in the loop
- Outbound link autometic converted into linkdirect , and not opening
- Is it possible to use multiple post_name, post_title and post_content?
- Modifying Author Link to add Author Meta in URL
- SEO Friendly URL on dynamic product page produced via shortcode
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Remove /product/ from url. I want only category name then product name
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Customize permalink wordpress category id
- Reoccurring 404 Errors on all subpages
- Permalinks stopped working after migration with WP all-in-one migration plugin
- How to remove custom post type and add category and post name
- Perform internal redirect in WordPress?
- “Custom Post Type Permalinks” plugin URL strcuture
- Filtering get_permalink in Jetpack / ShareDaddy
- Custom Permalink Plugin and Current Page/Ancestor in Menus
- plugin links not working [closed]
- Plugin generated taxonomies’ permalinks with custom placeholders
- How to get the permanent link in a plugin?
- This WordPress plugin isn’t creating links correctly
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- flush_rewrite_rules() not working with update_option_{$option}
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Disable plugin If slug contains specific word
- How do I create a custom permalink structure for a page template
- I want to filter my products with attributes [closed]
- How to embed a new string in url?
- Plugin for TinyMCE to create reference to other posts
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- help intercepting save_post through plugin
- TranslatePress | secondary language category/sub-category not working correctly “`/%category%/%postname%/“`
- Why the internal link get converted into a comment?
- Oops! That page can’t be found
- Error in Fetching Custom Post Type parent Category URL (slug)
- Hidden permalink different from displayed permalink
- WordPress Frontend Page using Plugin
- Child theme modifications not showing up
- Rewrite/Change custom taxonomy slug
- Create new page in wordpress plugin which doesn’t exist
- one url for all pages
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- Is it possible to have permalinks to sub-domain pages and to root pages within one single WP instance?
- How to update all in-site redirect URLs to destination URLs at once
- post id or permalink auto-incrementing number and reset everyday
- Changing author slug for a custom role without using plugin
- Category Arabic Slug shows as symbols in plugin lists
- Custom author page for custom role
- Custom role not listed
- Members-only page, but accessible via sharable link
- added code to permalink (URL)
- How to setup same post slug for different categories?
- How to add add blank non-editable wp page like default blog for use with plugin
- get_permalink is causing a whitescreen
- Share on social media created listing after submission
- Rogue splash page keeps popping up
- Coming soon pages with rest of site in maintenance mode
- add_external_rule – rules deleted when visiting permalinks page
- How to disable wordpress page rewrite rule?
- How to programatically create a simple HTML page using the permalink of a WordPress post?
- How to maintain WordPress permalink structure with custom content with URL parameters?
- Change post permalink to external URL from custom field
- Unwanted Links and Spam WordPress Pages and Posts
- homepage olderposts link showing page not found
- 404 not found problem with URL rewrite custom category
- Adding Category in URL in some post
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- How to remove site name (https://exp.com/) from WORDPRESS site source links or file load url
- WordPress Plugin and other pages not opening
- 404 Error on a WordPress Website, Error disappears for a while and again appears
- claim a permalink and all sublinks in plugin
- Getting 400 Error in wordpress website
- Changing the “OT Process” Plugin’s Default Slug of /process/