{"repo":"szepeviktor/starter-plugin","free":true,"listed":false,"github":"https://github.com/szepeviktor/starter-plugin","clone":"git clone https://github.com/szepeviktor/starter-plugin.git","description":"Template for WordPress plugins, it took 7️⃣ years to write","language":"PHP","stars":78,"topics":["php","wordpress","phpstan","phpcs","composer","editorconfig","wordpress-plugin"],"license":"MIT","category":"saas-starters-boilerplates","readme_excerpt":"Ultimate WordPress Plugin Main File How to leave legacy technologies behind Source code in plugin-name.php needs PHP 8 which is present on more than 50% of WordPress installations. Support my work Please consider sponsoring me monthly if you use my packages in an agency. Parts of plugin main file - Header comment - PHP strict types - PHP namespaces - Prevent direct execution - Load autoloader - Prevent double activation - Define constant values in an immutable container - Load translations - Check requirements - PHP and WordPress minimum version - Multisite installation - Other plugins - Current theme - Composer packages - Hook plugin activation functions - Support WP-CLI - Display admin notice and deactivate plugin on error :bulb: Anything else goes into a separate file. What to avoid - :x: Global constants - :x: Global functions - :x: Classes without namespace - :x: Loading PHP files with require - :x: Code with side-effects outside the main file - :x: Immediate execution without add action in the main file - :x: Conditional function or class definitions --- Installation 1. Get the plugin ZIP from ... 1. Upload to Plugins / Add new / Upload /wp-admin/plugin-install.php?tab=upload Usage 1. Adjust settings ... 1. Or add a hook add filter('project/enable', ' return true'); to functions.php","default_branch":null,"files":null,"tree":[],"storefront":"/r/szepeviktor","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/szepeviktor/starter-plugin/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}