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 fix the admin menu margin-top bug in WordPress 5.5?
- Cleaning up WordPress to improve performance?
- How build a custom login/register form with error handling?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- API JSON Data in WordPress
- How To Change The Html of Products filtration sidebar in Woocommerce?
- How To add custom radio boxes to WooCommerce Billing page and change total price by this field?
- PHP Code stuck in Cache [Memcached] [closed]
- Hide post if matches current month and year
- jQuery .each to get post meta and subtract from a sum
- Displaying the Month and Year that a page was Created?
- Static variable and add_rewrite_rule?
- How to access global variable $menu inside a class function
- Parse error syntax error unexpected t_string [closed]
- Working with wordpress plugin and theme templates structures
- Generate YouTube image thumbnail in a Gutenberg block – ACF + Timber
- How to upload a file to a folder named after the user_id via plugin
- Can’t access variable outside for loop
- adjust section according to country?
- Search not showing all results
- Change tinyMCE editor to allow marked content when pasting from Word
- Issues when changing == to ===
- Having Issue on Redirecting With Session in WordPress
- Why is $wp->request empty in WordPress 6.0?
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- linking stylesheets and scripts with functions.php
- Make a database query using WordPress
- get_the_ID() in the footer returns wrong value
- Get the last 5 products from each category
- WP_Query multiple post results
- Convert Featured products loop into Recent products loop?
- Admin-ajax php not working on new wordpress version
- Fatal error: Cannot redeclare function
- Issue Enqueueing WordPress style.css
- Add valid XHTML closing img tags to WordPress galleries
- Only load certain artists on this page
- Changing wordpress default language
- Using flickr api in custom wordpress plugin
- Contact form – problem with displaying message about sent mail
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Woocommerce order status payment
- Adding image upload in tag section – WordPress plugin development
- How do I set a hidden field to a value?
- Display logged in user name and lastname on page
- How to Add a cutsom slug to my custom author role
- How to output the taxonomies that are assigned to each custom post?
- Reading URL Parameters
- Issue in displaying the ongoing event and current events in the post
- If is_page include/else not working all of a sudden
- Conditional formatting on data fetched from MYSQL
- Enqueue script only on child pages of custom post types
- Attach and retrive multiple pdf files to post or page
- Link to index.php from home.php?
- How do I remove an action hook inside a class that is called by another class?
- Merging Multiple WordPress Websites
- Replace an array (with identical values) with another array in the_content
- WordPress/NGINX not respecting the category URL for new posts
- Display current user metadata on WordPress page
- Need help transforming echo to return for use with shortcode
- PHP Error Backtrace / create_function deprecated
- Filtering markers on google map by WordPress category[SOLVED]
- scroll scrpit to particular button position to next id when click button
- Check if a user is logged into my WordPress site which is on a different server
- What is wrong in this code?
- perform mathematical operation on shortcode
- WordPress / PhpStorm / XDebug and plugin_dir_path issues
- directorypress theme error mysql_error() [closed]
- wp add inline style in loop
- Do_shortcode on PHP file outside theme ALMOST works
- WordPress 2014 Theme – Featured Content with multiple tags?
- Facebook share button only share the_permalink(), without thumbnail, tilte, excerpt, etc
- ACF repeater image in video poster with jquery
- How to display the date under the post title?
- What is proper way to use the php if statement? [closed]
- Differences and dis/advanages between: Fast-CGI, CGI, Mod-PHP, SuPHP, PHP-FPM
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page