The best way is to not do that. There’s no need for a plugin file to ever include the wp-config.php.
You’re doing it backwards. WordPress loads plugins. Plugins don’t load WordPress.
Related Posts:
- What security concerns should I have when setting FS_METHOD to “direct” in wp-config?
- What could a hacker do with my wp-config.php
- WP Config for FTP credentials
- Bad Request (Invalid Hostname) on working server, database problem
- Some plugins adding full server path after url (with custom wp-content folder)
- register_theme_directory somehow “fails” when folder is outside of WP-Folder
- htaccess and wordpress config files are regularly over written
- plugings request url is the old url
- Can you limit the memory usage of a particular plugin?
- Single Must Use Plugins Directory for local development
- Enable Full SSL for WordPress
- How to change constants in WordPress wp-config.php programmatically?
- Enabling WP_USE_EXT_MYSQL to support old plugin
- DOMAIN_CURRENT_SITE constant being regularly overridden [closed]
- Redirect to another page using contact form 7? [closed]
- Use wp-config.php constants in all files of plugin
- Can WordPress Drop-ins be given their own directory?
- Editing wp-config.php
- Disable globally “Crop thumbnail to exact dimensions (normally thumbnails are proportional)” with Multisite
- What is the purpose of WP_CONTENT_URL?
- WordPress failing to update plugins
- How to request admin-ajax.php correctly when wordpress URL and site URL are different?
- How to get database connection details without longing to cpanel in WordPress?
- WordPress wp get_temp_dir return non exiting folder, thus failing plugin & themes update
- Using wp config to connect to a DB from a plugin
- No plugin updates after moving wp-config.php above root map
- How to have WordPress send a user confirmation/validation email on signup
- How do I disable a plugin enforced by my host (in mu-plugins)?
- Do Plugins effect site loading time?
- Adding Featured Image in Post List
- Auto login using Active Directory and Windows Authentication
- Should I use RIPS tool to test my themes and plugins?
- Plugin search sorting for admin section – WordPress [duplicate]
- How to disable autocomplete for inputs in contact form 7? [closed]
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- Plugin Functionality Only for Editor and Administrator
- Plugin to hide admin menu (vertical menu bar)
- Building WordPress Plugin Using FPDF – How do you get post content from currently viewed post?
- Storing Email Account Passwords for SMTP Mailing for a WordPress Plugin
- action-scheduler vs wp-background-processing
- How to get images from EDD post?
- Do you clean up your self-written plugins’ at deactivation?
- Function to see how many plugins on a site need updating
- Restored WordPress on new Server – Can’t auto-update plugins
- How many SQL queries WP Super Cache make to serve cached page?
- omit / remove ” from category list
- Is any information available in PHP files in WP about plugin activation history?
- Download any file after submitting a form [closed]
- Call to undefined function get_userdata in user.php
- AJAX search posts and pages
- How to export all content with feature images?
- Cron Job not working in plugin
- this jQuery function works perfect in static html page but not on wordpress
- Run a plugin just ‘once’ per page reload
- How do I add content to the dashboard in WordPress?
- Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?
- $wpdb update query in plugin only updating one column
- How to see which sites use my installed plugins (wordpress multisite)
- how remove font to increase site speed load
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Can the benefits of performance optimization plugins outweigh the tax of installing them on performance?
- Post deleted in trash [closed]
- WordPress API functions not working at AJAX functions.php call
- How to relate 3 wordpress components with each other (Create database relationships)
- How do I show content from a plugin using the template the site is currently working with?
- WP audio video player with previous next options
- Archive with months of current year only
- Interface needed to transfer contents in a table on a web page to the Add New Product interface
- Need to setup grid like thumbnail of recent posts on sidebar
- Advanced Custom Fields Plugin – Images not displaying
- is_front_page breaks with url parameters generated by a plugin
- page duplication on wordpress that wont stop
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- How to pass all received IDs through the function for in_category
- Getting unknown text in footer of email
- WordPress delete cookie
- I want the Widget title to set below contant
- Storing Array of values into wordpress options
- I have a plugin that applies a Google translation to my page–how does the browser know which language to display?
- WordPress Add advertising ads befor and after content with periority [closed]
- Upload image to wordpress using ionic/cordova with WP REST API V2
- woocommerce blank page after clicking add to cart [closed]
- Working plugin code breaks admin
- Filter the HTML content of plugin
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- A plugin is giving me “You do not have sufficient permissions to access this page.” error
- WordPress automatic plugin update
- Use wordpress for school results?
- Woocommerce Bookings – Resource needs to be allocated for part of the booking duration, not the whole booking
- Load my plugin before cache
- How to get current template file used by WordPress?
- Plugin link does not appear in my toolbar
- Supersize plugin error in internet explorer 7 and 8 [closed]
- Zigconnect Plugin: Allowing editors to remove connections
- Need Header slider plugin recommendation [closed]
- How to change data format in custom meta box field [closed]
- Sidebar Slideshow widget with text [closed]
- How to get an error message if a form is empty (plugin: Post for site) [closed]