TEST FIX On php 8 syntax
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d6c10baf0c
commit
4ee862a10e
|
|
@ -47,8 +47,7 @@ function dynamiques_taxonomy_init()
|
||||||
);
|
);
|
||||||
register_taxonomy('etiquettes', array('articles', 'revues'), $args);
|
register_taxonomy('etiquettes', array('articles', 'revues'), $args);
|
||||||
}
|
}
|
||||||
add_action(hook_name: 'init', callback: 'dynamiques_taxonomy_init', priority: 0);
|
add_action('init', 'dynamiques_taxonomy_init', 0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SYNCHRONISATION DES TAGS ('ETIQUETTES') ENTRE ARTICLES ET REVUES.
|
* SYNCHRONISATION DES TAGS ('ETIQUETTES') ENTRE ARTICLES ET REVUES.
|
||||||
|
|
@ -68,7 +67,7 @@ add_action(hook_name: 'init', callback: 'dynamiques_taxonomy_init', priority: 0)
|
||||||
function dynamiques_apply_current_article_tags_to_related_revue($article_ID)
|
function dynamiques_apply_current_article_tags_to_related_revue($article_ID)
|
||||||
{
|
{
|
||||||
if (!$article_ID) return;
|
if (!$article_ID) return;
|
||||||
$related_revue_ID = get_field(selector: 'related_revue', post_id: $article_ID);
|
$related_revue_ID = get_field('related_revue', $article_ID);
|
||||||
if (!$related_revue_ID) return;
|
if (!$related_revue_ID) return;
|
||||||
|
|
||||||
$article_terms = get_the_terms($article_ID, 'etiquettes');
|
$article_terms = get_the_terms($article_ID, 'etiquettes');
|
||||||
|
|
@ -80,10 +79,10 @@ function dynamiques_apply_current_article_tags_to_related_revue($article_ID)
|
||||||
$revue_updated_terms_ids = array_values(array_unique(array_merge($revue_ids, $article_ids)));
|
$revue_updated_terms_ids = array_values(array_unique(array_merge($revue_ids, $article_ids)));
|
||||||
|
|
||||||
|
|
||||||
wp_set_object_terms(object_id: $related_revue_ID, terms: $revue_updated_terms_ids, taxonomy: 'etiquettes');
|
wp_set_object_terms($related_revue_ID, $revue_updated_terms_ids, 'etiquettes');
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action(hook_name: 'save_post_articles', callback: 'dynamiques_apply_current_article_tags_to_related_revue', priority: 99, accepted_args: 3);
|
add_action('save_post_articles', 'dynamiques_apply_current_article_tags_to_related_revue', 99, 3);
|
||||||
|
|
||||||
|
|
||||||
function dynamiques_update_revue_tags_from_related_articles_on_save_post($post_ID)
|
function dynamiques_update_revue_tags_from_related_articles_on_save_post($post_ID)
|
||||||
|
|
@ -91,7 +90,7 @@ function dynamiques_update_revue_tags_from_related_articles_on_save_post($post_I
|
||||||
if (get_post_type($post_ID) !== 'revues') {
|
if (get_post_type($post_ID) !== 'revues') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$related_articles = get_field(selector: 'articles', post_id: $post_ID);
|
$related_articles = get_field('articles', $post_ID);
|
||||||
if (!$related_articles) return;
|
if (!$related_articles) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,7 +98,7 @@ function dynamiques_update_revue_tags_from_related_articles_on_save_post($post_I
|
||||||
dynamiques_apply_current_article_tags_to_related_revue($article->ID);
|
dynamiques_apply_current_article_tags_to_related_revue($article->ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_action(hook_name: 'save_post_revues', callback: 'dynamiques_update_revue_tags_from_related_articles_on_save_post', priority: 99, accepted_args: 1);
|
add_action('save_post_revues', 'dynamiques_update_revue_tags_from_related_articles_on_save_post', 99, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -129,6 +128,5 @@ function retetest()
|
||||||
'operator' => 'IN', // ou 'AND' si tu veux toutes les étiquettes
|
'operator' => 'IN', // ou 'AND' si tu veux toutes les étiquettes
|
||||||
]],
|
]],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
add_action('init', 'retetest');
|
add_action('init', 'retetest');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user