Skip to content

Instantly share code, notes, and snippets.

View sebastianmoran-archive's full-sized avatar

Sebastian Moran sebastianmoran-archive

  • Massachusetts
View GitHub Profile
@manospsyx
manospsyx / woocommerce-bundles-optional-checkbox-state.php
Last active February 29, 2020 20:32
Use this plugin to have optional bundled items checked/selected by default.
<?php
/**
* Plugin Name: WooCommerce Product Bundles - Optional Items Checked by Default
* Plugin URI: https://woocommerce.com/products/product-bundles/
* Description: Use this plugin to have optional bundled items checked/selected by default.
* Version: 1.1
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Manos Psychogyiopoulos
*
@psorensen
psorensen / edd-recurring-create.php
Created January 20, 2017 19:28
EDD Recurring Creation
$args = array(
'expiration' => date( 'Y-m-d 23:59:59', strtotime( 'January 3, 2018', current_time( 'timestamp' ) ) ),
'created' => date( 'Y-m-d 23:59:59', strtotime( current_time( 'timestamp' ) ) ),
'status' => 'pending',
'profile_id' => 0,
'transaction_id' => 0,
'initial_amount' => 1,
'recurring_amount' => 700,
'bill_times' => '1',
'period' => 'yearly',
@amboutwe
amboutwe / yoast_seo_meta_remove_dates.php
Last active October 5, 2020 08:39
Remove Date Meta Tags Output by Yoast SEO
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Date Meta Tags Output by Yoast SEO
* Credit: Yoast development team
* Last Tested: Apr 09 2019 using Yoast SEO 10.1.3 on WordPress 5.1.1
* For Yoast SEO 14.0 or newer, please see https://yoast.com/help/date-appears-search-results/#h-managing-dates
*/
add_action('wpseo_dc_'.'DC.date.issued', '__return_false'); // Premium versions 5.2 or older
@amboutwe
amboutwe / wordpress_robots_custom.php
Last active April 17, 2026 01:25
Filters and example code for Yoast SEO robots or WP robots.txt
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: June 09 2020 using WordPress 5.4.1
*/
add_filter('robots_txt','custom_robots');
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_link.php
Last active April 9, 2026 12:22
These snippets are examples of how you can modify the Yoast SEO breadcrumb visual output. These snippets will not alter the breadcrumb schema output. Please consult the schema documentation to change the breadcrumb schema: https://developer.yoast.com/features/schema/api#to-add-or-remove-graph-pieces
@corsonr
corsonr / disable-woocommerce-3-zoom.php
Created April 5, 2017 08:48
Disable WooCommerce 3.+ Zoom
<?php
remove_theme_support( 'wc-product-gallery-zoom' );
@amboutwe
amboutwe / yoast_seo_canonical_change_woocom_shop.php
Last active September 12, 2025 09:28
Code snippets for the Yoast SEO canonical output
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change the canonical link for the shop page
* Credit: Scott Weiss of somethumb.com
* Yoast Doc: https://developer.yoast.com/features/seo-tags/canonical-urls/api/
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1
*/
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1 );
@Nicholas-Cardot
Nicholas-Cardot / edd-recurring-paypal.php
Created July 17, 2017 21:37
Using a backup method for getting payments that allows for imported subscriptions
public function get_subscription( $ipn_data = array() ) {
$parent_payment_id = absint( $ipn_data['custom'] );
$backup_method = false;
// Check if we can find the payment via the internal EDD payment ID
if( !empty( $parent_payment_id ) ) {
$payment = edd_get_payment_by( 'id', $parent_payment_id );

Generate Search & Replace Script For All Applicable http-to-https Image Assets.

  1. run wp --allow-root db query "select post_content from wp_posts where post_content like '%<img src%';" --skip-column-names --silent | grep -oP "<img\s+.*?src=['\"](.*?)['\"].*?>" | grep -oP "https?://[^\"]*" | sort | uniq
  2. using parse_url(), create a PHP function* to find unique hosts and add first occurence of each to an array of links.
  3. Itterate through new list of links and run through a CURL function** to determine
  4. Add links with 200-300 status to an array
  5. Produce Search & Replace script based of returned values

Function Reference

@Nicholas-Cardot
Nicholas-Cardot / migration.php
Last active August 15, 2019 03:52
WooCommerce to EDD Migration Script
<?php
/*
Template Name: Migration Script
*/
error_reporting(E_ALL);
//reuire_once('/stripe/init.php');
\Stripe\Stripe::setApiKey("my_key");