This file contains hidden or 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
$posts = get_posts( | |
[ | |
'post_type' => 'post', | |
'numberposts' => - 1, | |
'lang' => '' | |
] | |
); | |
$posts_ids = wp_list_pluck( $posts, 'ID' ); | |
foreach ( $posts_ids as $post_id ) { |
This file contains hidden or 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
sudo zip -r website.zip config database libs resources routes storage vendor app |
This file contains hidden or 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
<?php | |
add_action( 'init', function () { | |
if ( ! isset( $_GET['update-user-passwords'] ) ) { | |
return; | |
} | |
$new_password = 'your-new-password'; | |
$users = get_users(); | |
foreach ( $users as $user ) { |
This file contains hidden or 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('wp_head', 'show_template'); | |
function show_template() { | |
global $template; | |
if ( isset( $_GET['test-template-name'] ) ) { | |
echo basename($template); | |
exit; | |
} | |
} |
This file contains hidden or 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
sed -i 's/old.com/new.com/g' *.sql |
This file contains hidden or 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
<?php | |
add_filter( 'wpcf7_verify_nonce', '__return_false', 9999 ); | |
add_filter( 'wpcf7_spam', '__return_false', 9999 ); | |
$form = \WPCF7_ContactForm::get_instance( $contact_form_id ); | |
\WPCF7_Submission::get_instance( $form ); |
This file contains hidden or 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 prefix_url_rewrite_templates() { | |
if ( get_query_var( 'photos' ) && is_singular( 'news' ) ) { | |
add_filter( 'template_include', function() { | |
return get_template_directory() . '/single-news-image.php'; | |
}); | |
} | |
if ( get_query_var( 'videos' ) && is_singular( 'news' ) ) { | |
add_filter( 'template_include', function() { | |
return get_template_directory() . '/single-news-video.php'; | |
}); |
This file contains hidden or 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( 'wp', function () { | |
return; | |
if ( $_COOKIE['PHPSESSID'] !== 'xxxx' ) { | |
return; | |
} | |
global $sitepress; | |
foreach ( range( 1, 100 ) as $iteration ) { |
This file contains hidden or 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( 'wp', 'porto_child_categories' ); | |
function porto_child_categories() { | |
$categories = get_terms( | |
[ | |
'taxonomy' => 'product_cat', | |
'lang' => '' | |
] | |
); | |
foreach( $categories as $category ) { | |
pll_set_term_language( $category->term_id, 'uk' ); |
This file contains hidden or 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
<?php | |
/** | |
* Filter Elasticsearch posts by current language. | |
*/ | |
add_filter( 'ep_formatted_args', function( $formatted_args, $args ) { | |
if ( function_exists( 'pll_current_language' ) ) { | |
$lang = pll_current_language(); | |
if ( $lang !== false ) { |