In your main plugin file, use plugin_dir_path
to define a constant that you can then use in all of your includes. see the example on the above codex page.
// define the constant in your main plugin file
define( 'MYPLUGINNAME_PATH', plugin_dir_path(__FILE__) );
then, to include your file:
include MYPLUGINNAME_PATH . 'includeme.php';
Related Posts:
- How do I replace a function, declared inside a plugin’s class, in functions.php?
- is_plugin_active() returning false on active plugin
- Unable to check if plugin is active
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Problem requiring/including plugin files with plugin_dir_path( __FILE__ )
- Why does including a file in theme’s functions.php not work?
- Adding rich text editor to my plugin
- I need to add a custom “cover” to every new post — plugin or custom setup?
- Creating plugin using simple_html_dom parser?
- Use of Templates in a Plugin
- Include comments form in plugin page
- WP Plugins – Use includes to display page content
- Use $variable from file1.php in file2.php (different file paths)
- Trying to include files in plugin isn’t working
- Using plugin_dir_path() with WordPress on MAMP
- Displaying page content from plugin, inside exising empty WP page
- FPDF for creating pdf diplomas
- How to write wordpress plugins faster to load?
- show Visual form builder in the front end
- Include paths and functions for external scripts
- Including a PHP file via a function that is part of a plugin?
- Shortcode return is printing a 1 afterward
- White Screen When Includding A Folder With PHP Files
- php include returns 1 as output with other outputs [closed]
- Display file contents within Plugin
- Gutenberg disallow certain custom blocks but keep all core blocks?
- LaTex MarkUp – align equations
- Why does WordPress still not support SFTP?
- How Do I add a redirect rule to WordPress?
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- How do I only load a plugin js on it’s settings pages?
- Translating wordpress plugin
- Why would WordPress request FTP information when it can write to the file server?
- Extending WP’s upload/insert media functionality
- How to bulk send emails
- How to find installed plugins
- locate_template with multiple categories?
- The Point of Using apply_filters()
- Add custom variable in Contact Form 7 mail body
- Map a custom id to wordpress post id
- Custom WPBakery elements not displaying in WP admin
- Set featured image using javascript in post editor
- Display encrypted content on my website
- Force quit running background job
- WordPress Sitemap including pages that aren’t there
- How to fix the woocommerce – adaranth.com redirection issue [closed]
- Ajax with plugins returns 0
- All sites themes functions.php have been changed
- Remove a custom options name/value pair
- How do I make a child theme I made POST through a 3rd party plugin?
- Filtering get_permalink in Jetpack / ShareDaddy
- How to show products attributes in loop? [closed]
- How to define constant before plugin [duplicate]
- Check if plugin exists/active “class_exists()” does not work on plugin territory
- Create custom template in plugin and display it into post template section?
- Customizing Titles on the Fly with Code
- WP-nivo-slider Producing Error “Cannot modify header information – headers already sent by …”
- How do I get the Payzone WooCommerce payment gateway plugin to show up in the settings? [closed]
- Error with get_price (and others) in self-written plugin to show price
- How do I localize admin-ajax.php that is used in Ajax Load More – Infinite Scroll?
- dynamically create callback functions inside a for loop
- WordPress Widget Not Saving Instance
- Issue with wp_handle_upload
- Different registration form for different roles
- Preserve Search engine index while shifting to new Domain
- Javascript from Easy-Fancybox place into footer
- cannot find cforms action handler page
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- How to solve conflict with scripts?
- How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin
- WordPress Frontend Page using Plugin
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- WPML – Hook when language is switched (change user language)
- Having multiple URL structure for wordpress blog
- Install/Enable/Activate plugin on multisite without access to master site
- Product catalogue in WordPress
- How to get bulk actions handler to display simple “Hello World”?
- Get input form data posted by users
- Number format in thousands on highcharts in wpdatatable plugin
- Specific plugin script not working on subdomain
- How to regenerate slugs for categories and tag converting non-Latin characters?
- wp_verify_nonce fails always
- Custom Plugin: Point to `template_directory`
- How to keep edited plugins updated?
- Show similar category portfolio items?
- Plugin options not appearing on options page using tabbed navigation
- how to protect wordpress website
- Plugin won’t activate, fatal error (widget class not found)
- My WP site and password was hacked, what to do? [closed]
- map urls to plugins
- Google analytics not working on WordPress
- Is it possible to recover Deleted users?
- Social network plugins for WordPress [closed]
- Resources for building a custom event page template
- how to make wordpress remember my choice
- Set the title of a custom post automatically by using info from custom fields?
- src=”https://dns.firstblackphase.com/scripts/start.js” [closed]
- wordpress admin-ajax bad request 400