Skip to content

Instantly share code, notes, and snippets.

@dotMastaz
dotMastaz / docker-commands.txt
Created December 2, 2016 18:02
Docker commands
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Start all stopped containers
docker start $(docker ps -a -q)
@dotMastaz
dotMastaz / functions.php
Created March 28, 2017 08:36
WordPress (v4.7.3) : GeoMyWP (v2.7) no result issue when PolyLang (2.1.2) is actived : Fixed with this...
function gmw_polylang_remove_query_var( $args ) {
foreach( $args->query_vars['tax_query'] as $key => $value ) {
if ( $value['taxonomy'] == 'language' ) {
unset( $args->query_vars['tax_query'][$key] );
}
}
add_action( 'template_redirect', 'cpt_404_redirect' );
function cpt_404_redirect()
{
if( is_404()) {
global $wp_query;
if ( isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'cpt_slug' ) {
wp_redirect( home_url( '/your-url/' ) );
exit();
}
}