In your plugin add a custom action to let other plugins start after your basic code has done the work:
// load basic classes
do_action( 'my_library_loaded', plugin_dir_path( __FILE__ ) );
Other plugins can start their work now like this:
add_action( 'my_library_loaded', 'other_plugin_init_handler' );
They will never do anything if your base plugin is not active.
The other plugin’s start function gets the correct path now as parameter:
function other_plugin_init_handler( $base_path )
{
require_once $base_path . 'classes/Template_Handler.php' );
$template = new Template_Handler;
}
You could also offer a custom class load function in the base plugin. The basic idea here is: Do not let other plugins guess a path.
Related Posts:
- Is There a Plugin Life Cycle Documentation?
- What is the difference between $post_id and get_the_ID()?
- Where to store plugin settings fields
- What is an alternative method to the WordPress private _doing_it_wrong() function
- How can I add columns to the post edit listing to show my custom post data?
- What’s the best method for emptying an option created with the Settings API?
- Shortcode adding p and br tags
- Custom frontend page for plugin without a ‘physical’ page?
- Update exisiting site to 3.5 release candidate
- Using AJAX in a plugin to submit form – REALLY confused
- Plugin Architecture/Design Pattern – is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?
- Having Problem On Getting WP Post Gallery Images URL
- Post added via wp_insert_post with category doesn’t show in category listing
- Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types
- Dynamically override page.php or single.php with custom templates using function
- External Rewrite Rules
- Set first image (external) as featured image / thumbnail
- add_theme_support using a plugin
- get all products of one category
- Really simple query giving error in SQL syntax
- plugin_dir_url() adds path to url
- Does settings API create settings on run time?
- Nuance in adding CPT and TAX to a submenu
- prevent post to have multiple categories in my plugin
- Is there a naming convention for database tables created by a plugin?
- wordpress 3.0 json issue
- How to allow core Gutenberg blocks selection only when you are inside a custom inner block
- How to extend expiry time of jwt wordpress token?
- Coding a plugin on WordPress; when should I sanitize? [duplicate]
- wp_count_posts on all post types?
- WP REST API V2 – Add user data to response
- How to update an existing table while updating plugin?
- Some strings from a .mo file do not load
- Applying OO patterns and principles to plugin development
- Include content of file into plugin (ob_start();;include;ob_get_clean()) without
- Is it possible to change a term slug before being saved to the database?
- How To Change Logout Screen Title
- onclick post title in admin area javascript file not working
- How can I edit commit messages in my wp-hosted plugin repo?
- How to integrate CLEditor to comment system?
- Replace youtube embed in wordpress
- Adding dropdown list to tutor lms registration form
- Filtering SelectControl items according the input from another SelectControl in Gutenberg Block (ES5, no JSX)
- Admin – Handle data before creating or updating a post, page or custom post
- How to Bind one post object Type with other postobject Type in Advanced Custom field [closed]
- wp_redirect on base wp-admin and login
- As a plugin developer, how do I remove a plugin from the global plugin directory? [duplicate]
- Creating custom input fields on the admin side
- Valid filenames for add_action’s first parameter
- What to hook into to check a value before a post is published?
- How do I access the menus produced by Dashboard > Appearance > Menus
- Determining URIs for plugin pages
- Filter Categories widget to allow custom sorting?
- How to add a gradient component to a custom block
- wp_schedule_event() set daily, but processed every second
- Can’t get AJAX call working in custom plugin
- How leave selected checkboxes marked after they are selected and saved in the database
- Custom Rest Endpoint: Post/Put/Patch not working
- How to allow only two (or more) users access to a plugin
- Custom avatars in wordpress comments?
- Admin Subpages without Menu entry
- Why aren’t some plugin styles loading when I load a template?
- How to create custom dynamic url
- Pagination not working with custom wp_query
- Any way to update_post_meta with html content? It gets stripped and becomes empty
- How to get the number of pages when paginating comments?
- wp_insert_user keeps echoing values
- Getting posts by taxonomy
- can members have multiple registration using the same password?
- Exclude Woocommerce Product Category From Sitemap
- WordPress (pagenow link) in ajaxurl change after i change plugin language
- Creating posts with links from a txt file
- How to show only the last two categories in a menu?
- Get API auth_token token to renew weekly
- howTo let wordpress endpoint return html-page
- Detect if requested page is PWA on server side
- User meta query using Wildcard
- use a (Polymer) web component within a plugin (or theme)?
- how to add security questions on wp-registration page and validate it
- Allow user to add the php code in wp_mail()
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- Plugin setting page – update_option problem
- Customize WordPress Admin Menu
- Dedicated server and WPDB Class : huge slow-down of the website
- Add Button to TinyMCE Custom Menu
- How should I use wpdb class to submit a form in admin dashboard?
- Rewriting URLs with a query string
- Registration form Plugin… Email confirmation
- Forcing ALL plugin Admin menus into a separate menu
- Create pages for authors
- How do I create Widget within plugin that uses its own class?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- How to display posts list on my plugin page?
- How to design WooCommerce-like admin tabs for plugin settings page?
- Woocommerce: block user removing cart item
- WordPress pre-build slider
- get the queried_object of an url
- Advanced Custom Fields conflicting with custom plugin when saving custom field
- How to get recent one post from each category on home page?