By the WP coding guide, please, use WP Plugin API.
In your case place the following code into start of the main .php
file of the plugin.
// Working directory definition.
define( 'MY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
// Attaching executable
require_once MY_PLUGIN_DIR . 'folder/class-my-class.php';
Related Posts:
- Why “Call to a member function on a non-object” in plugin only?
- 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
- Replace old theme that understand old css (vcex_icon_box css_animation)
- Plugin Breaking WordPress Login
- Including a PHP file via a function that is part of a plugin?
- How to fix ‘Call to undefined function do_settings()’ error?
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- How can I use WordPress functions in my stylesheet?
- WP showing “warning: call_user_func_array()”, What to do?
- Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
- How can I pass a variable to wp_ajax action?
- How can i change an image’s author?
- Creating search filter through plugin
- WP-Members redirect if member ALREADY logged in
- How to edit/delete single row items in a table on my own menu page
- Displaying Gravity Form data on WordPress page [closed]
- Get a list of galleries from an album in NextGEN Gallery [closed]
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- How to trigger $_GET request within admin plugin page?
- Wp favorite posts get user favorites in profile using buddypress [closed]
- How to ‘clone’ a wp plugin to make small changes
- add mediaelement.js plugins into WordPress video player control bar
- Preferred way of cacheing a value in php
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Automatically add attributes to woocommerce product?
- Edit Yoast SEO breadcrumbs output [closed]
- Adding a slider captcha to the comment system
- How to put JQuery/Ajax inside shortcode?
- Query all customers/users and check for duplicate information
- WordPress function not being called from jQuery method
- How can I add hyperlink in WP_Error message?
- WordPress WPforms customization
- wp_remote_get() returns 403 while file_get_contents() does not
- Where these .js file come to source code?
- WordPress Widget Not Saving Data
- Center and hide overflow of WP toolbar custom links
- How I can internationalize variables within the function _e () __ (), etc?
- How to delete all trashed item in one-go
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- Why can’t I call a (member) function from within a foreach?
- WordPress Related Plugin – only show when related content
- Are there action hooks for comments?
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Plugin onclick button activate other plugin
- Show icons or badges under title on product archives/category pages
- Why does this code snippet create a critical error on my site? [closed]
- How to redirect non www to www? [closed]
- WordPress custom post type image in RSS
- Must use Plugin not updating HTML code in head
- Add logo to admin menu in my plugin
- Get data from wp_posts of mysql in to variables of wordpress-php script
- WordPress plugin won’t create custom tables
- Cannot access empty property error in Advanced Access Manager
- Trying to get property of non-object wordpress error message
- Using plugin_dir_path() with WordPress on MAMP
- Advertising: Every page refresh counts as 3 ad impressions
- Somehow adding to “Insert Into URL” posts are contradicting each other
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- Woo-commerce Update price as a Bulk from My offline software export
- How to disable login in iframe which is hosted in same domain?
- Display Author name PHP (Selfmade Plug-IN)
- Display top level parent category as a single product body class (Woocommerce)
- Allow a particular user to access a particular plugin?
- Auto delete empty posts
- WordPress Standard Fix Errors
- How do I use a plugin’s shortcode attribute value in another function?
- Change the address of the music player if not available
- WordPress hide post from custom post-type on a single page
- How can I find related learndash course id from woocommerce product object?
- update_post_meta is not working for me when I use e.preventDefault for update button
- Try to debug a plug-in written by someone else
- How to use Datatable with Ajax when creating plugin on WordPress?
- Use modulo condition in ACF repeater Field
- Add a WooCommerce Product Variant with attributes programmatically
- Site broken by unedited php?
- Return function results within shortcode
- Help with customising love it plugin (use within foreach)
- Plugin communication between sites that use it?
- insert multiple entries in database using a loop issue
- Query Shortcode from a multisite to appear on a different site?
- Theme editor removes backslashes
- Retrieve data from multiple WordPress sites using PHP script
- Plugin Hook: Get posts
- What is the process for reimplementing a back up WordPress?
- Showpost and last
- date function not correctly returning date
- Undefined variable _POST
- I want to remove the register/login WordPress top bar from my website
- PHP Creating a formula from mysql db values and db stored math operator
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- I want create woocommerec match products columns
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress
- Use inline callable for hooks and filters