Skip to content

Instantly share code, notes, and snippets.

@fabriziofeitosa
Last active September 9, 2020 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabriziofeitosa/b126136ff9d82b5edb1955c9ee17e368 to your computer and use it in GitHub Desktop.
Save fabriziofeitosa/b126136ff9d82b5edb1955c9ee17e368 to your computer and use it in GitHub Desktop.
(WP) Criando atividade CRON WordPress
<?php
// Verifica se existe, se não criará
if ( ! wp_next_scheduled( 'cron_get_price_node_js' ) ) {
// O valor 'twicedaily' é um valor para executar duas vezes ao dia. Recomendo ter o CODEX da função para saber mais
// TEMPO , 'de quando em quanto tempo' , 'nome do action'
wp_schedule_event( time(), 'twicedaily', 'cron_get_price_node_js' );
}
// 'nome do action' , 'nome da função que deverá ser chamada'
add_action( 'cron_get_price_node_js', 'update_allurl_pricenodejs_admin_action' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment