A collection of WordPress PHP code snippets.
The original intent was for use in WP Codebox, but they can be used in any WordPress theme, plugin or as a mu-plugin.
The status field is used to indicate the current status of the snippet. This is useful for tracking the progress of a snippet. The following statuses are used:
Complete - ✔️
WIP - 🚧
Unknown - ❓
Broken - ❌
Run generate-readme.sh to generate the README.md file.
Title
Version
Type
Status
Description
Ajax Logger
1.0.0
Plugin
✅
Record all admin_init requests to troubleshoot high admin-ajax.php requests.
Title
Version
Type
Status
Description
BBP WPAL Filters
1.0.1
Plugin
✅
BuddyBoss Platform Filters to improve page speed.
Title
Version
Type
Status
Description
log-hook-calls.php
1.0.0
Plugin
✅
Log all hook calls to a file
PHP Memory Info
1.0
mu-plugin
✅
Adds a Tools -> PHP Memory page to display PHP ini and WordPress memory settings and current usage.
show-browser-cookies.php
1.0.0
snippet
✅
* Description Shows your browsers cookies
Application Logs
1.0
Plugin
✅
Displays top 10 lines from a log file in the WordPress admin section.
WP Redirect Log
1.0
mu-plugin
✅
Logs all wp_redirect and wp_safe_redirect calls to a log file in the uploads directory.
Title
Version
Type
Status
Description
staging-environment.php
1.0.0
Snippet
✅
This snippet will enable and disable plugins based on the WP_ENVIRONMENT_TYPE
Title
Version
Type
Status
Description
wp-mail-log-to-file.php
1.0.0
Plugin
✅
Log wp_mail function to a file
wp-mail-test.php
1.0.0
Plugin
✅
Used to send a test email to test the wp_mail function.
Title
Version
Type
Status
Description
check-ports.php
1.0.0
Plugin
✅
Original created to test if ports are open outbound on hosting providers to be able to send tranational email
Title
Version
Type
Status
Description
post-title-permalink.php
1.0.0
Snippet
✅
This code will add a link to the title of the post, so that the title is clickable.
Title
Version
Type
Status
Description
WP Ultimo API Fix
0.1.0
* Type: snippet
✅
Fixes the WP Ultimo API calls that fail and timeout after 10 seconds.
Title
Version
Type
Status
Description
Failover Status Monitor
1.0.0
Plugin
✅
Monitors failover status and provides notifications.
Added block-http-requests.php
Added disable-wp-rocket-preload.php
Added wp-admin-login-message.php for adding messages to the WordPress admin login page.
improvement: Updated generate-readme.sh to check for missing fields
Require version to be a field
Added plugin powerkit-svg-lazyload-fix.php
Updated disable-checkout-and-limit-login.php to be disabled via define('WP_MAINTENANCE_MODE', true);
Added disable-checkout-and-limit-login.php
feat(debug): Added wp-redirect-log.php mu-plugin
feat(debug): Added php-memory.php
feat(ultimo): Added ultimo-api-fix.php
improvement: Added better detection to disable-wp-rocket-lscache.php
fix: Errors with disable-lscache-notice.php
docs(readme): Updated README-header.md to add in generation process
feat(cache): Added disable-wp-rocket-lscache.php
feat(caching): Added nginx-helper-purge-schedule.php
Removed wp-cli package cron logger and created it's own repository.
feat(wp-cli): Added wp-cli package cron-logger
feat: Addd Simple Membership member per page snippet
improvement: Updated generate-readme.sh to generate CHANGELOG.md
refactor: Complete refactor of the entire repository.
Added cloudflare load balancing log url
Merge pull request #2 from nickchomey/patch-2 - Update ajaxlog.php - Move logs to a subdirectory to keep root tidy
Updated wp-failover.php to include more features.
feat: Added acf-pull-contact-form-name-ids.php
improvement: Nick Chomey merged PR#1 Mega improvements to ajaxlog.php
feat: Created woocommerce-wc_product_loop_transient-expiration-to-1-day.php
improvement: Moved all WooCommerce snippets to woocommerce folder
feat(buddyboss): Found BBP WPAL Filters in the wild.
fix(buddyboss): Fixed bbp-wpal-filters.php due to cut off.
feat: Added check-ports.php
feat: Added change-admin-email.php
feat(redirection-search-replace): Added redirection-search-replace.php
docs(redirection-search-replace): Updated doc for redirection-search-replace.php
fix: Fixed typo
feat: Added multisite/sunrise-subdomain-to-subdiretory-mapping.php
feat(caching): Added nginx-gravity-forms-stripe-cache-exclude.php
feat(show-logs-admin): Added show-logs-admin.php
chore(ajaxlog): Put ajaxlog.php and ajaxlog.md into own directory
chore(ajaxlog): Renamed ajaxlog.md to README.md
Squased git commit history.
9ebde9d (HEAD -> dev, origin/dev) Merging in changes from dev branch
1315d61 Create ultimo-custom-domain-edits.php file
549760f Create mu-dashboard-shortcode.php
501ad64 Merge branch 'main' of github.com:managingwp/wordpress-code-snippets into main
804c764 Update wp_mail.php
81a5195 Update log-wp_mail.php
0804bdb Update log-wp_mail.php
d83bea2 Create wp_mail.php
ffa7a48 Update betteruptime-heartbeat.php
db9e200 Added file log-admin-notices.php
fbe1efa woocommerce-hide-costofgoodssold-metadata.php
aef11bc Issue with disable-plugin-updates.php having no add_filter woops.
2174646 Update disable-plugin-updates.php
38b1c6d * Added file disable-lscache-notice.php Disables the admin notice Litespeeds LSCache generates about conflicting plugins installed * Added log-wp-mail.php to log mail() function to file.
5e19134 Added file disable-lscache-notice.php Disables the admin notice Litespeeds LSCache generates about conflicting plugins installed
4cd9b6e Create betteruptime-heartbeat.php
4d3d0db Merge branch 'main' into dev
7532325 Typo and added credit
8f89a22 Merge branch 'main' into dev
27b408a Changed code in post-title-permalink.php as it broke menus
f6d7a50 Merge branch 'dev' of github.com:managingwp/wordpress-code-snippets into dev
f68d8fe Changed code in post-title-permalink.php as it broke menus
0de3636 Update README.md
d78036a Added disable-plugin-updates.php enable-core-updates-version-control.php log-hook-calls.php
1e7edc5 Merge branch 'dev' of github.com:jordantrizz/wordpress-code-snippets into dev
21c2507 Added log-hook-calls.php
74884b2 Merge branch 'main' into dev
5e83a9d Added post-title-permalink.php
d607c30 Merge branch 'main' into dev
f405fc5 Improved overall code, added if request is from a visitor or logged in admin
701e125 Improved overall code to be one line
92b82ec Improved overall code to be one line
17b9d24 Merge branch 'main' into dev
fd65bcb Updated improper code syntax to support PHP8
df5225a Merge branch 'main' into dev
2aedceb Restructure repository files
ab023b4 Restructure repository files
852b0dc Update README.md
21c0198 Update README.md
2071565 Update README.md
4f15c9e Update README.md
20af5d4 Update README.md
0028bde Update README.md
ac8a5a6 Delete ajaxlog.php
5bb8217 Create ajaxlog.php
b9ecdb0 Create README.md
5328ed3 Update ajaxlog.php
c1123ae Update ajaxlog.php
e981c54 Update ajaxlog.php
2205405 Update ajaxlog.php
a2a6648 Create ajaxlog.php
6d37733 Create wp-admin-maintenance-mode.php
f42de0e Create show-browser-cookies.php
c7489af Update woocommerce-order-search-in-admin-bar.php
d01d9a6 Added staging-environment.php
86c0197 Another update
4bfc0d3 Updated by Ovidiu to work properly on WooCommerce order page
3a26821 Update woocommerce-order-search-in-admin-bar.php
1c17d42 Update woocommerce-order-search-in-admin-bar.php
a9fab44 first commit