This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Define type of server | |
| * | |
| * Depending on the type other stuff can be configured | |
| * Note: Define them all, don't skip one if other is already defined | |
| */ | |
| define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WP Bag of Tricks | |
| 1. Helpful Scripts/Plugins: | |
| Hacks: | |
| http://wordpress.org/extend/plugins/tac/ | |
| http://wordpress.org/extend/plugins/exploit-scanner/ (Can be extremely resource intensive.) | |
| http://wordpress.org/extend/plugins/wp-malwatch/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # SHORTS | |
| # DIRECTORY SEPARATOR | |
| define( 'DS', DIRECTORY_SEPARATOR ); | |
| # PATH SEPARATOR | |
| define( 'PS', PATH_SEPARATOR ); | |
| # Absolute path to the WordPress directory. | |
| ! defined( 'ABSPATH' ) | |
| AND define( 'ABSPATH', dirname( __FILE__ ).DS ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Custom Post Type Data Export | |
| Description: Exports custom post type data using REST API and PHP classes with namespaces and bearer authentication | |
| */ | |
| namespace CustomPostTypeDataExport; | |
| use \WP_REST_Controller as WP_REST_Controller; | |
| class ExportController extends WP_REST_Controller { | |
| public function __construct() { | |
| add_action('rest_api_init', [$this, 'register_routes']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Add Google Tag Manager javascript code as close to | |
| the opening <head> tag as possible | |
| =====================================================*/ | |
| function add_gtm_head(){ | |
| ?> | |
| <!-- Google Tag Manager --> | |
| <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
| new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
| j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Alter dns-prefetch links in <head> | |
| */ | |
| add_filter('wp_resource_hints', function (array $urls, string $relation): array { | |
| // If the relation is different than dns-prefetch, leave the URLs intact | |
| if ($relation !== 'dns-prefetch') { | |
| return $urls; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types = 1); | |
| use WebPConvert\WebPConvert; | |
| set_time_limit(0); | |
| chdir(dirname(__DIR__)); // one level up to project root | |
| // check requirements | |
| if (! is_file('vendor/autoload.php')) { | |
| echo "File vendor/autoload.php not found. Is the path correct?"; | |
| exit(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Filename-based cache busting | |
| * Version: 0.3 | |
| * Description: Filename-based cache busting for WordPress scripts/styles. | |
| * Author: Dominik Schilling | |
| * Author URI: https://dominikschilling.de/ | |
| * Plugin URI: https://gist.github.com/ocean90/1966227/ | |
| * | |
| * License: GPLv2 or later |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: The Combiner | |
| Plugin URI: http://dd32.id.au/wordpress-plugins/?plugin=combine-css-js | |
| Description: Combine CSS & JS into one large monolithic file | |
| Author: DD32 | |
| Version: 1.0 | |
| Author URI: http://dd32.id.au/ | |
| */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // ... | |
| public function load_dependencies(){ | |
| /** | |
| * Base functions | |
| */ |
NewerOlder