This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* remove meta field */ | |
DELETE FROM wp_postmeta WHERE meta_key = 'YourMetaKey'; | |
/* batch deleted spam comments */ | |
DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam'; | |
/* batch deleted all unapproved comments */ | |
DELETE FROM wp_comments WHERE comment_approved = 0; | |
/* disable comments on older posts */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Only display the cheapest shipping rate | |
*/ | |
function my_only_show_cheapest_shipping_rate( $rates, $package ) { | |
$cheapest_method = ''; | |
// Loop through shipping rates | |
if ( is_array( $rates ) ) : | |
foreach ( $rates as $key => $rate ) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', 'evolution_remheadlink'); | |
function evolution_remheadlink(){ | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'index_rel_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'feed_links', 2); | |
remove_action('wp_head', 'feed_links_extra', 3); | |
remove_action('wp_head', 'parent_post_rel_link', 10, 0); | |
remove_action('wp_head', 'start_post_rel_link', 10, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Disable embeds on init. | |
* | |
* - Removes the needed query vars. | |
* - Disables oEmbed discovery. | |
* - Completely removes the related JavaScript. | |
* | |
* @since 1.0.0 | |
*/ | |
function evolution_disable_embeds_init() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Disable the emojis | |
*/ | |
function disable_emojis() { | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woo_add_cart_fee() { | |
global $woocommerce; | |
if ( is_cart() ) { | |
$woocommerce->cart->add_fee( __('Custom', 'woocommerce'), 5 ); | |
} | |
} | |
add_action( 'woocommerce_before_cart_table', 'woo_add_cart_fee' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DIY Popular Posts @ https://digwp.com/2016/03/diy-popular-posts/ | |
function shapeSpace_popular_posts($post_id) { | |
$count_key = 'popular_posts'; | |
$count = get_post_meta($post_id, $count_key, true); | |
if ($count == '') { | |
$count = 0; | |
delete_post_meta($post_id, $count_key); | |
add_post_meta($post_id, $count_key, '0'); | |
} else { | |
$count++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html | |
/* | |
* This action hook allows to add a new empty column | |
*/ | |
add_filter('manage_post_posts_columns', 'misha_featured_image_column'); | |
function misha_featured_image_column( $column_array ) { | |
// I want to add my column at the beginning, so I use array_slice() | |
// in other cases $column_array['featured_image'] = 'Featured Image' will be enough |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Update woocommerce cart after quantity change without clicking the button --> | |
<style> | |
.woocommerce button[name="update_cart"], | |
.woocommerce input[name="update_cart"] { | |
display: none; | |
} | |
</style> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
register_post_type( 'custom_post_type_name', array( | |
'capability_type' => 'post', | |
'capabilities' => array( | |
'create_posts' => false, // Removes support for the "Add New" function ( use 'do_not_allow' instead of false for multisite set ups ) | |
), | |
'map_meta_cap' => true, // Set to `false`, if users are not allowed to edit/delete existing posts | |
)); |