=== Custom Functions === Contributors: littlebizzy Donate link: https://www.patreon.com/littlebizzy Tags: custom, functions, filters, settings, wp-config Requires at least: 4.4 Tested up to: 4.9 Requires PHP: 7.2 Multisite support: No Stable tag: 1.0.0 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html Prefix: CSTMFN Enables the ability to input custom WordPress functions such as filters in a centralized place to avoid the dependence on a theme functions.php file. == Description == Enables the ability to input custom WordPress functions such as filters in a centralized place to avoid the dependence on a theme functions.php file. * [**Join our FREE Facebook group for support!**](https://www.facebook.com/groups/littlebizzy/) * [**Worth a 5-star review? Thank you!**](https://wordpress.org/support/plugin/custom-functions-littlebizzy/reviews/?rate=5#new-post) * [Plugin Homepage](https://www.littlebizzy.com/plugins/custom-functions) * [Plugin GitHub](https://github.com/littlebizzy/custom-functions) *Our related OSS projects:* * [SlickStack (LEMP stack automation)](https://slickstack.io) * [WP Lite boilerplate](https://wplite.org) * [Starter Theme](https://starter.littlebizzy.com) #### The Long Version #### Some custom functions plugins rely on the database, which is very unstable and doesn't allow proper debug checks. This plugin integrates the new code (syntax) editor API from WordPress COre to edit an actual PHP file where all your custom WordPress functions and filters can be stored as a physical file on the server. This way, the syntax editor can do its job properly, the functions/filters are parsed faster (e.g. via PHP Opcache) and no reliance on database is needed, meaning no database queries or possible fatal errors/crashes scenario. Current version edits the following file (do not edit/delete via SFTP): `wp-content/functions.php` To access visit WP Admin > Plugins Submenu > Custom Functions link In the future we may have a include line at the very top of wp-config.php to prioritize loading order, as certain defined constants (etc) are better loaded prior to the mu-plugins / plugins / theme load sequence. Dev team notes (1.0.0): the plugin editor integration has been a bit complicated because to be executed outside of the plugin/theme editor it needed several adjustments in javascript, replacing event handlers, overwrite some part of the code, etc. The server side code (managed via an AJAX action) to validate the submitted code uses functions copied from the WP core instead of calling their functions because the code does not allow to change default paths and URLs (no functions params or available filters). When the code is submitted, the wp-content/custom-functions.php file is saved directly without any validation. After that, the plugin sets a WP internal status in 'scrape mode' to detect PHP fatal errors, and performs two remote calls, one to the same plugin page emulating current logged user status (same cookies and headers emitted by browsers), and one to the homepage. If any of them produces a code exception, then error info is captured and makes a roll-back to the previous custom-functions.php code. Last minute tweaks: - Create file on plugin activation starting with Plugins 3. Edit file under WP Admin > Plugins Menu > Custom Functions submenu 4. Do not edit/delete via SFTP or otherwise: `wp-content/custom-functions.php` == Frequently Asked Questions == = How can I change this plugin's settings? = There is a settings page where you can add custom WordPress functions/filters or defined constants. = I have a suggestion, how can I let you know? = Please avoid leaving negative reviews in order to get a feature implemented. Instead, we kindly ask that you post your feedback on the wordpress.org support forums by tagging this plugin in your post. If needed, you may also contact our homepage. == Changelog == = 1.0.0 = * initial release * tested with PHP 7.0 * tested with PHP 7.1 * tested with PHP 7.2 * object-oriented codebase * plugin uses PHP namespaces * creates/edits `wp-content/functions.php`