Make sure to add it to a hook that fires at or after ‘wp’ ;
Example:
add_action( 'wp', 'your_function_name');
function your_function_name(){
global $post;
$your_page_id = get_option('your_option_name');
if( $post->ID == $your_page_id ):
//your include
endif;
}
Related Posts:
- How to include class from addon after to be sure one class exists in the main plugin?
- include wp-blog-header not working on MAMP
- get_option() not returning expected value from plugin
- Include file in plugin file
- can’t access some WordPress function from my plugin
- I’m including a html file in my plugin, but it can’t find its css or js files
- Including content into an add_shortcode() function
- How to include files in the loop via ajax
- What are the advantages to the Settings API?
- How to add Request header in WordPress remote api calls
- Init action hook running late after PayPal’s return url?
- Get specific color from admin color scheme
- wp_remote_get doesn’t work with secure connections https?
- Why are two functions over-riding each other?
- how to set context in WordPress for unit testing
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- plugin development: storing language specific options
- Support auto-save and revisions for custom fields
- Gutenberg – What is the best way to save/update post meta?
- Dequeue theme stylesheets but keep widget styling on custom page template
- WP_Query with tax_query, order by most ‘matches’
- Using the Settings API, how should I add multiple values to an option?
- Save Checkbox value in Plugin [duplicate]
- Plugin updates, version dependencies, and backwards compatibility
- Where and how does WordPress store and use its plugin and hook information?
- Cache directory needed for plugin
- How to sanitize user input?
- Remove Internal Style Sheet if no Value Provided?
- Using the default wordpress uploader inside plugin
- WordPress after content Hook & external template part
- Alter post object before display
- get_query_var not works
- Correct check for any admin page with editor
- Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin
- Show/Hide ‘add new user’ custom fields in wordpress admin panel by click another field
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- How to perform a heavy and long process in cron jobs?
- Woocommerce extend tax report with custom column
- Capture mediaelement events
- Dynamically creating classes for Widget API
- Insert/Update values to a table after blogname option etc. is updated
- wordpress how to query wp_options table
- Does admin_print_scripts-$hook_suffix work for nested paths to individual files?
- How to add a widget to the post editing view?
- How to query custom db table?
- How to only load css for used blocks on frontend
- adding wp-cli commands to plugin: how to document to users?
- Cannot change caption for a plugin
- Remove all removed pages from wordpress
- Creating an empty page programatically
- Multiple API Endpoints (wp_remote_get)
- Invalid hook call on save, not edit when using swiper slider
- Call to undefined function is_home() or any conditional tags
- how to load the comment template from a plugin
- Change/Set Page Title and Meta Tags from Page Called within a Plugin
- WooCommerce Endpoints content
- Make dynamic string translatable
- Look for a file in a theme before loading from plugin
- wp_schedule_event is registered but function isn’t running
- when i activate my plugin i want to auto create pages with shortcodes
- Simple plugin don’t display content
- How to display TinyMCE HTML view?
- get the permalink error
- Cannot output plugin twice with shortcode
- How to make an admin plugin menu page go full screen?
- Gutenberg – Call google map render function in save after DOM has been rendered
- Woocommerce get_term_by() in transition_post_status hook doesn’t works
- Does $this context change in an AJAX callback?
- Home page is not loading, where in other pages are displaying on the site
- Custom table / Alternative to WP_List_Table
- Why is that only the first row getting inserted into Mysql table when i import csv file on backend custom plugin?
- WordPress custom url without using any of the custom tags given
- WordPress with React: Saving and Using Data Collected with fetch
- How to call a plugin function from a page
- If user is logged-in display/hide widgets ( siteorigine) [closed]
- Javascript not being loaded only in custom taxonomy template
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- tweaking the
- User Registration Moderate
- external Integration with wordpress timeout error
- Implementing Select2 plugin into WordPress
- Problem to return more than single line captions
- Object Oriented plugin, add action and variables
- Why user is added back in database after deletion?
- Use plupload to upload images and save them to custom folder and database table
- add_action priority and taxonomy used in plugin
- How to add conent (text) to Add New pages form of admin in WordPress
- Post data in wp-admin to external database
- Images not displaying on live server
- redirect word-press page with page values
- How to do searching based on keywords added in page
- Open media box library from link
- How to only Load scripts on variable products page
- Using tag or inline style attribute?
- remove () from category number [closed]
- Find Any Theme’s page.php File
- WP Job Manager – Show recent jobs as cards
- Admin Menu for New Post
- multiple record insert creating many duplicate records