Skip to content

Instantly share code, notes, and snippets.

View CapWebSolutions's full-sized avatar

Matt Ryan CapWebSolutions

View GitHub Profile
@CapWebSolutions
CapWebSolutions / .gitignore
Last active April 18, 2024 14:22
Default gitignore for plugins
# -----------------------------------------------------------------
# .gitignore for WordPress plugins
# ver 20240417
#
# To ignore uncommitted changes in a file that is already tracked, use
# git update-index --assume-unchanged
#
# To stop tracking a file that is currently tracked, use
# git rm --cached
#
@CapWebSolutions
CapWebSolutions / capweb-screaming-frog-excludes.txt
Created March 15, 2022 14:41
Starting list of URLs to exclude when creating Screaming Frog config file for WordPress site.
/**
* WordPress URL Exclude List for Screaming Frog Spider
* @author Matt Ryan - https://capwebsolutions.com
* @date 2022-03-15
*/
// Nav: Configuration | Exclude
// Gets rid of:
// wp-content plugins, themes, mu-plugins, uploads, etc.
@CapWebSolutions
CapWebSolutions / capweb-screaming-frog-url-rewriting.txt
Last active March 15, 2022 14:42
Rules for basic WordPress URL rewriting in Screaming Frog.
/**
* WordPress URL rewriting rules for Screaming Frog Spider
* @author Matt Ryan - https://capwebsolutions.com
* @date 2022-03-15
*/
// Nav: Configuration | URL Rewriting
// Replacing:
// https://example/com/blog/page/2/
@CapWebSolutions
CapWebSolutions / dump-timezone.php
Last active September 22, 2021 20:15
Dump timezone in admin for debuging
add_filter('admin_menu','dump_timezone_choice');
function dump_timezone_choice($my_data) {
$my_data = wp_timezone_string();
var_dump($my_data);
return($my_data);
}
@CapWebSolutions
CapWebSolutions / the_copyright_year.php
Created September 16, 2021 20:34
Shortcode to insert in footer for auto adjusting copyright year. Tested in Elementor.
@CapWebSolutions
CapWebSolutions / change_rss_feed.php
Created July 7, 2021 16:17
Change RSS feed on main WordPress feed from 12 hrs down to 1 hr. ref: https://wordpress.stackexchange.com/questions/6569/decrease-rss-cache-time-in-plugin Use this in event that external services are not picking up blog posts quickly enough in low traffic sites.
add_filter('wp_feed_cache_transient_lifetime', 'cws_shorten_rss_feed_timeout');
function cws_shorten_rss_feed_timeout( $interval, $url ) {
if( 'https://<example.com>/feed' == $url )
return 3600;
return $interval;
}
@CapWebSolutions
CapWebSolutions / add-column.php
Created June 25, 2021 15:18
Add column to MainWP sites screen to display Last Security Scan date
<?php
/**
* Create Custom Column in the Manage Sites table for Last Secirty Scan date
* ref: https://meta.mainwp.com/t/solved-add-second-field-to-dashboard/3015
* ref: https://meta.mainwp.com/t/display-group-s-column-in-the-manage-sites-table/2932
* ref: https://meta.mainwp.com/t/create-custom-column-in-the-manage-sites-table-with-data-from-client-data/2877
*/
add_filter( 'mainwp_sitestable_getcolumns', 'mycustom_mainwp_sitestable_getcolumns', 10, 1 );
@CapWebSolutions
CapWebSolutions / Links
Created June 3, 2021 13:43 — forked from lukecav/Links
Speed Up Your WordPress Site with These 3 Advanced Techniques Workshop - WordSesh 2021
@CapWebSolutions
CapWebSolutions / BulkDeleteAllOrderNotes.sql
Created June 3, 2021 13:40
WooCommerce: Bulk Delete Orders / Products Super Fast
DELETE FROM wp_commentmeta WHERE comment_id IN ( SELECT ID FROM wp_comments WHERE comment_type = 'order_note' );
DELETE FROM wp_comments WHERE comment_type = 'order_note';
@CapWebSolutions
CapWebSolutions / display_woo_tax_status.php
Created May 25, 2021 14:47
Display Tax Status column in WooCommerce Admin
add_filter( 'manage_edit-product_columns', 'tax_status_product_column');
function tax_status_product_column($columns){
$new_columns = [];
foreach( $columns as $key => $column ){
$new_columns[$key] = $columns[$key];
if( $key == 'is_in_stock' ) {
$new_columns['tax_status'] = __( 'Tax status','woocommerce');
}
}
return $new_columns;