Skip to content

Instantly share code, notes, and snippets.

View theRealRizeo's full-sized avatar
💭
Getting work done

Paul Kevin theRealRizeo

💭
Getting work done
View GitHub Profile
@theRealRizeo
theRealRizeo / ns-cloner-filter-sites.php
Created April 3, 2023 05:52
Filter sites from NS cloner
<?php
/**
* Filter out sites to show in cloning list.
*/
add_filter( 'ns_cloner_sites_list', function( $sites ) {
$my_site_ids = array( 1, 10, 3, 8, 13 ); // The site ids you only want to show. Replace with the ids of your sites.
foreach ( $sites as $id => $name ) {
if ( ! in_array( $id, $my_site_ids, true ) ) {
unset( $sites[ $id ] );
@theRealRizeo
theRealRizeo / ns-cloner-exclude-tables.php
Created March 7, 2023 10:48
NS Cloner exclude certain tables
<?php
add_filter( 'ns_cloner_site_tables', 'customer_exclude_ns_cloner_site_tables', 10, 2 );
/**
* Exclude certain tables from cloning.
*
* @param array $tables The selected tables. This contains the prefix
* @param int $site_id The site id.
*
@theRealRizeo
theRealRizeo / ns-cloner-pro-search-replace.php
Created January 24, 2023 06:26
Cloner search and replace pro version
<?php
$array_of_post_types = array(
'attachment',
'page',
'post',
'revision',
'wp_global_styles',
);
$array_of_tables = array(
'wp_commentmeta',
@theRealRizeo
theRealRizeo / woocommerce-amazon-fba-order-tracking-cron.php
Created January 12, 2023 06:37
WooCommerce Amazon FBA Order tracking cron
<?php
function custom_mcf_check_order_tracking_details() {
global $ns_fba_inst;
if ( ! is_object( $ns_fba_inst ) ) {
return;
}
$orders = get_posts(
@theRealRizeo
theRealRizeo / mcf-change-shipping-method-title.php
Created January 3, 2023 08:07
MCF Amazon change shipping method title
<?php
add_filter( 'woocommerce_shipping_method_title', 'change_mcf_shipping_method_title', 10, 2 );
/**
* Modify the method shipping title.
* This will affect both the title and the method title.
*
* @param string $method_title The method title.
* @param WC_Shipping_Method $shipping_class The shipping method.
@theRealRizeo
theRealRizeo / ns-cloner-sample-clone.php
Last active January 3, 2023 08:11
WP Cloner custom clone
<?php
$array_of_post_types = array(
'attachment',
'page',
'post',
'product',
'revision',
'wp_global_styles',
);
$array_of_tables = array(
@theRealRizeo
theRealRizeo / WordPress-DigitalOcean-Mysql
Created July 23, 2021 09:06
WordPress Managed Digital Ocean MySQL Modes
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
<?php
function copy_post( $post_id ) {
if ( function_exists( 'PLL' ) ) {
$model = PLL()->model;
$post = get_post( $post_id );
$post->ID = null;
$translations = pll_get_post_translations( $post_id );
foreach ( $model->get_languages_list() as $language ) {
$tr_id = pll_get_post( $post_id, $language );
@theRealRizeo
theRealRizeo / php-block.js
Created January 31, 2019 12:12 — forked from pento/php-block.js
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
<?php
/**
* Delete old Defender logs from all sites
* Clean up custom post meta that is no longer used
* call the function defender_delete_old_posts()
*
* @param bool $echo - echo the tables
*/
function defender_delete_old_posts( $echo = false ) {
global $wpdb;