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
- update asset url on free slider revolution version 6.5.25
- ImageMagick on wordpress 6.5.5 for Linux Alma 8 success but which no magick
- Add custom button to the changeset status in the Customizer
- Can I leave off plugin textdomain for terms used in core?
- Correct way to serialize the data of options table?
- How to force WordPress to temporarily switch locale (using qTranslate)? [closed]
- Custom admin column disappearing when using Quick Edit [duplicate]
- Create page when plugin is activated
- How can I translate the name of my Plugin for other languages?
- How to make a plugin auto-add item to nav menu
- Logs to check when the plugin was first installed for the first time
- How to get custom field image url of specific size
- Getting “Fatal error: Call to undefined function wp_cache_get() in option.php” after updating a cache plugin [closed]
- Facebook Like Button On Individual Comments
- Keep user’s privileges on accessing contents in JSON response
- Displaying admin notice dynamically
- Get total number of comment of the posts written by an author
- How to Dequeue All WordPress Assets
- How to replace or display the special characters from JSON API plugin [closed]
- Output HTML only on individual post view
- printf – problem to understand code
- Pass info from functions.php to plugin
- add_query_arg not working
- Widget for adding HTML markup to a page
- WordPress filter that hook after each action/filter hook
- When to use action hooks and plugins
- Uncode theme content block header ignoring saved changes/not updating?
- Unique 4 digit number
- User Session and Stored Cookies not get removed
- get 404 when accessing wp-admin/plugin-install.php
- Pre booking doesn’t work with custom bootstrap modul in woocommerce [closed]
- WordPress change Language not working
- Bulk updates to post_content
- Advanced AJAX Page Loader ignores other JS code
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- How to add FB like + share AND also other Social Buttons on ALL pages and posts?
- file-gallery plugin line 1573 broken in 4.2 upgrade [closed]
- PHP Error When a plugin is active
- Errors when trying to use a plugin to write to the database
- Completely disabling password reset/recovery
- How to load different homepage on Mobile.?
- WordPress REST API Plugin Development – Add Custom Endpoint
- how to prevent all css and javascripts files from loading
- Hook into the rendering of a WordPress Template
- Best way to count visitors?
- I changed .live() to .on() but change is not reflected on the server
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- How do I set up XAMPP to allow me to download plugins and themes?
- WP-API Custom Post Type json_no_route
- How can recognize post’s category?
- Developing plugin, where to place action hooks etc?
- Widget content turns up before title
- How do I fill the Home Description?
- Disable “auto embed” feature when pasting text and links
- How to prevent users to view server files using WP File Manager plugin?
- Alternative Hook to the_content for Changing Background Color
- How to use WordPress header function and footer function and not load word press database
- I want to display “how many times this tag used in WordPress?”
- Suspect incomplete .pot file – what to do?
- Password Protect wp-content?
- How to make cover image in post block expand to entire screen?
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- Conditional Fields depending on checkboxes
- Translation plugin with default language?
- wordpress ajax pagination object value does not change
- Google analytic issue in wordpress
- image upload error wordpress
- Simply Exclude – Category feed exclusion is excluding from category feed instead of just the main feed
- OOP Plugin: Where should I place the action hooks in the class?
- How to get the real address from a url (permalink)
- How to make temporary expiring link for a downloadable file
- Add country flags
- Content expands beyond its column container [closed]
- Make plugin admin page visible to other roles
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?