Does wordpress allow me to add a php file to the root directory to
execute custom scripts?
WordPress can’t prevent you from adding PHP files to the root directory, but there is no builtin functionality to load those files. You can load them yourself but if you are not careful they will load outside of WordPress context, which is a painful way to work.
What you want, almost certainly, is a plugin or a MU-Plugin. MU-Plugins work similar to what you are asking, if I understand you, but instead of placing your file in the site root you would place it in wp-content/mu-plugins/. It will be loaded automatically for all sites in the network and cannot be disabled except by deletion from the server.
Related Posts:
- Namespacing WordPress project according to FIG standards
- What’s the proper way to use wp_enqueue_script/style?
- Change the actual (or viewable) WordPress directory structure
- Accessing site’s root from themes folder
- Custom location for attached images
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Correct folder permissions?
- subdirectory index.php is not working
- Accessing an image folder inside public web directory
- Best way to schedule daily change in CSS parameter
- PHP in CSS file?
- Automatically Add Page Links to Nav Menu
- Automatically generator a WordPress installation on my subdomain
- Auto create Nextgen Gallery on post creation [closed]
- New user – Create a folder
- Autoloading Classes in Plugins
- How do I prevent a folder from reappearing in my home directory?
- Resource 404 error on multisite subdirectory install
- Permission functions within wordpress
- WP white screen of death after duping a site that works fine on same server
- Correct Syntax for uploading files to custom directory in WordPress
- Can I have a php site on subdirectory of WordPress?
- How to create a build for quickly deploying a server with WP?
- Get a list of folders inside uploads directory
- count() parameter must be an array or an object that implements countable in laravel
- Reposition WooCommerce breadcrumb outside of wrapper content
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- How to validate WordPress generated password in DB using PHP?
- How do I get the author’s page url from their ID?
- How can I access the “description” of a menu item?
- How can I call a row of user specific data from a custom table added to the WP Database
- How to upload a media file via FTP and then create an attachment post with it?
- Keep salts when moving a site?
- Theme url in all plugin pages
- Upgraded to php7.0, now ssh updates don’t work [closed]
- Add before_content and after_content to register_sidebar
- Redirect to a different page through registration, depending on page
- Creating a related post section based on similar categories
- How do I retrieve meta_key names with get_user_meta($user_id) call
- Use custom post type for a store locator
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Way to add captions to gallery images by code
- Echo possibly causing custom template formatting conflict
- proper way to add css using functions.php?
- How do I create my own .php file with a code part and echo it on different pages?
- “Undefined index” error when saving empty array with checkboxes
- Conditional using get_the_ID() not working [closed]
- WordPress plugin admin page – using WordPress function in linked php file
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- Decoded malware code [closed]
- PHP Notice: Undefined offset: -1 – Navigation Previous/Next
- Where is the PHP code generating an element?
- How do I check or test a WordPress Auto Year Change Script?
- Prevent redirect to wp-login.php
- Trying to enqueue script – Nothing Happens
- Undefined offset: 0-wp-includes/meta.php:488 -Melding
- WordPress and PHP Version Upgrade issue [closed]
- Images Uploaded saving onto older/previous year folders
- PHP Redirect condition
- WordPress 4.2.3 on Windows Server 2008 R2 Creating Files as read only
- WooCommerce “Checkout Now” button [closed]
- Defining multiple categories for showing latest posts
- Finding and removing duplicates within WP Arrays
- Hard-coding a shortcode as the last menu item in primary navigation?
- Removal of all posts content in bulk, keeping the posts itself
- Blog suddenly shows Archive instead of index page
- WP-CLi PHP Warning: mysqli_query(): (HY000/1356): View During Search Replace
- Is it possible to access admin-ajax.php using PHP?
- Loading Elementor templates in a Bootstrap modal on button clicking
- Adding custom field to product category and show it to shop/category shop page
- How to check if is page template inside functions.php
- How to hide a div section when user is logged in, in single product woocommerce
- REST API custom endpoint to fetch pages and posts not working
- display custom plugin view on front end inside template body
- Wp redirect – reset password
- How do I get data from my database into my Custom Export Field
- Fix hover images blink
- How to auto-generate random numbers in username?
- How to add a custom class for iframe by embed_oembed_html
- Generate random access token to a post page
- Filter loop by ‘price’ with meta_query
- remove public static function wp_link_dialog()
- Find the method which AJAX GET calls
- Adding button to wordpress menu
- List users in a dropdown for login
- WordPress pagination broken on blog page, working for search results page
- wp_get_archive for category returning different URLs on different but similar sites
- Widget header unique classes
- Trouble using wordpress functions in a pop-up modal form
- admin-ajax.php loading many times
- how to indicate on post listing title if user already liked this post
- wordpress – page not loading (404) even if it’s there
- if is specific custom post in cpt
- Trying to add taxonomy terms to search results page
- Run a WordPress blog (subdirectory) in a Laravel WebApp – SEO Concerns
- custom AJAX filtering logic and outputting results into an Elementor Loop Grid widget
- translating a custom taxonomy term in a shortcode
- how can I get the selected term of a custom taxonomy