There is no built in “user code” mechanism is WordPress. Your options for running your code are the theme’s functions.php
file, a plugin, or a mu-plugin.
You are aware of the first two options, the first of which you reasonably want to avoid. Writing a simple plugin is pretty trivial so I would not be afraid to try that.
The third option is less well known. If you create a directory called mu-plugins
in the wp-content
directory– in other words, /wp-content/mu-plugins/
— and place PHP files in there, WordPress will execute them automatically.
Related Posts:
- How can I make it so the Add New Post page has Visibility set to Private by default?
- InDesign to WordPress workflow
- Prevent publishing the post before setting a featured image?
- Publish Post After Click On A Link
- Peer Review Plugin for Posts? [closed]
- HELP: Integrating WP with raw PHP code once published button is hit
- Action on post publish
- Display future posts?
- Calling a plugin in theme development
- Does codex.wordpress.org use a plugin of some sort? If so what plugin?
- download_url() appears as grey icons
- How to slice an array using posts_per_page? [closed]
- the_tags : can we insert a class
- WP_Query for custom post type and category_id not working
- how to execute some code after a post is published in WordPress [duplicate]
- Function added to hook “new_to_publish” not executing – custom plugin
- trigger email when post is published by someone a user follows
- Block wordpress style for my plugin admin page
- get current page number with wp_link_pages()
- How to write a new file when new post has been published in WordPress
- Remove Url Parameter WordPress
- Do something with thumbnail image on post publish
- wp_schedule_event need to deactivate plugin changing recurrance
- Add new post using a page inside the website
- WooCommerce store with ~30,000 products [closed]
- Using require_once in a Plugin?
- Being notified when some YouTube video in some post becomes unavailable
- plugin wants to update to wrong plugin
- Plugin.php: PHP Notice: Undefined offset: 0 in
- Where do I add a new table’s name in wpdb?
- How can i add a submenu to a custom menu of another plugin?
- Is there an action that is called when a post is restored from the trash?
- Accessing plugin functionality within WP REST API
- How to create popup same as wordpress popup feature
- Moving WordPress from host without FTP?
- custom plugin – custom post type -Selectable options for User
- Multiple navigation menus to a location?
- How to customize user search
- Add get_option to jquery
- Making my plugin translation ready. Poedit not working
- Network: retrieve a list of latest posts
- How to Know if a Plugin can be used with my Theme [closed]
- Not able to open category post [closed]
- Using custom JS plugins with WordPress?
- WordPress on AWS with ELB
- Add javascript to wp_head with call to plugin options?
- Use wordpress functions in another PHP file
- Using a function to change favorites listing
- custom user tables supported in SharDB plugin?
- Problem using Press-this book marklet
- Best place for if/else piece of code related to custom plugin?
- How do you assign a UUID to posts/products/comments/reviews?
- Reoccurring 404 Errors on all subpages
- password_reset hook is not working
- WordPress 4.8.1 php getting commented
- What is a rock solid development and deployment workflow? [closed]
- Yoast SEO settings unavailable in an archive page from wordpress plugin
- Exclude posts from widget while post is showing on home, single and categories
- Remove Yoast jQuery from front end
- How to change the post form from plugin?
- Set WordPress Transient Expiration via Variable Value
- Override plugin class which has namespace
- How to include a custom field in the woocommerce email?
- How can I use my custom wordpress theme on two websites? [closed]
- Is it normal/acceptable for plugin/theme developers to ask for an admin login to investigate a trouble ticket? [closed]
- Plugin create pages and use templates
- Wierd site output [closed]
- wp_ajax action responds with 0
- Execute a function when the entire page is displayed
- Is there any way to inject text onto pages?
- Plugin that lets visitors Like a post (not facebook) and stores likes in custom meta?
- Cannot read properties of undefined (reading ‘firstChild’) using photoswipe in product page
- Multisite Change from domain.com to sub.newdomain.com
- Find Plugin by file name
- Creating an admin button that when clicked shows a popup form
- How to list datas from database in a topic?
- Downloading a file
- Profiling the initial PHP file, anyone, that get like 10 seconds to load
- How use wp_insert_post and add og:custom tags?
- How to change “Read More” text?
- How to use wp_editor and save its data in wp_posts table
- WordPress database problem wp_posts, primary key
- Auto trigger of popup
- WordPress Plugin PHP Not Calling Function
- how to show the tables of my plugin in the export tab of WordPress?
- Do_shortcode before send email content
- Warning: Illegal offset type in /var/www/html/wp-includes/option.php on line 1924
- Get plugin to background of page
- What is a good way to test that plugin upgrades have completed properly?
- Advanced Custom Fields (ACF) Plugin – Random Image in Sidebar
- Include paths and functions for external scripts
- Remove the ‘Press This’ Tool
- Looking for a related post plugin which slides-in like the one at inc.com does [closed]
- which is this plugin ? [closed]
- Sync roles across several plugins
- How to write a specific url for only single page in wordpress?
- this code is fiven by chat-gtp but nothing match even I key in the value of a cell. help!
- How do i fix this error?
- How do i display the number of images on the “post screen”
- Set the Social Icon Size in footer