Skip to content

Instantly share code, notes, and snippets.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
<?php
$chars = array (
/** Cyrillics **/
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G',
'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh',
'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K',
'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O',
'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
'У' => 'U', 'Ф' => 'F', 'Х' => 'Kh', 'Ц' => 'Ts',
<?php
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'your_email_recipient_filter_function', 10, 2);
function your_email_recipient_filter_function($recipient, $object) {
$recipient = $recipient . ', [email protected]';
return $recipient;
}
add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
<?php
/**
* Hide category product count in product archives
*/
add_filter( 'woocommerce_subcategory_count_html', '__return_false' );
<?php
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
<?php
add_action( 'publish_post_after_month', 'musilda_publish_post_after_month' );
function musilda_publish_post_after_month() {
$post_id = 123;
wp_publish_post( $post_id );
}
add_action( 'init', 'musilda_single_event' );
function musilda_single_event(){
wp_schedule_single_event( 30 * DAY_IN_SECONDS, 'publish_post_after_month' );
<?php
// Delete all failed orders custom action
add_action( 'musilda_delete_failed_orders', 'musilda_delete_all_failed_orders' );
// This function will run once the 'musilda_delete_failed_orders' is called
function musilda_delete_all_failed_orders() {
$args = array(
'status' => 'failed',
);
<?php
global $wp_aui;
$custom_posts = get_posts($args);
foreach($custom_posts as $post) : setup_postdata($post);
$content = $wp_aui->save($post);
wp_insert_post( array( 'ID' => $post->ID, 'post_content' => $content ) );
endforeach;