Answer the question
In order to leave comments, you need to log in
Why is the polylang connection between posts not saved?
There is a simple plugin like this:
add_action ('save_post', 'foo');
function foo($post_id){
global $polylang;
$eng_id = pll_get_post($post_id, 'en');
if (!$eng_id) {
$post = get_post($post_id);
$eng_post_params = [
'post_title' => $post->post_title . '-eng',
'post_date' => date( 'Y-m-d H:i:s' ),
'post_type' => 'gun_model',
'post_status' => 'publish',
];
// Удаляем хук, чтобы не было зацикливания
remove_action( 'save_post', 'saveCustomField' );
$eng_id = wp_insert_post( $eng_post_params, true );
// Ставим хук обратно
add_action( 'save_post', 'saveCustomField' );
$polylang->model->post->set_language($eng_id, 'en');
// pll_save_post_translations([
// 'ru' => $post_id,
// 'en' => $eng_id
// ]);
$polylang->model->save_translations('gun_model', $post_id, array('en' => $eng_id));
}
}
Answer the question
In order to leave comments, you need to log in
When you click on a point, you are passing it to photoClick, and you are trying to access the data-* properties of the clicked object. And the dot doesn't have them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question