Created
July 24, 2024 17:17
-
-
Save dantetesta/34ee8380a7d552fc0b6c7320896d7612 to your computer and use it in GitHub Desktop.
Editar o Switcher para False em todos os registros do CPT produtos
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
<?php | |
function wp_scripts_update_produtos_destaque() { | |
// Argumentos para a consulta de todos os posts do CPT 'produtos' | |
$args = array( | |
'post_type' => 'produtos', | |
'post_status' => 'publish', | |
'numberposts' => -1 | |
); | |
// Consulta todos os posts do CPT 'produtos' | |
$produtos = get_posts($args); | |
// Atualiza o valor do meta field '_destaque' para false em cada post | |
foreach ($produtos as $produto) { | |
update_post_meta($produto->ID, '_destaque', false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment