'search_deleted',
)
)
);
exit;
}
if ( ! $is_existing_search ) {
$current_search_id = '';
$posted_search['current_id'] = '';
} else {
$posted_search['current_id'] = $current_search_id;
}
$posted_search['id'] = $requested_search_id;
$sanitized_search = acewpcf_sanitize_content_search( $current_search_id, $posted_search, array_keys( $stored_searches ) );
if ( '' === trim( $sanitized_search['name'] ) ) {
/* translators: %d: next available content search number. */
$default_search_name = __( 'Content Search %d', 'ace-content-filters' );
$sanitized_search['name'] = sprintf( $default_search_name, count( $stored_searches ) + 1 );
}
$stored_searches = acewpcf_replace_associative_entry_preserving_order( $stored_searches, $current_search_id, $sanitized_search['id'], $sanitized_search );
update_option( ACEWPCF_OPTION_CONTENT_SEARCHES, $stored_searches );
wp_safe_redirect(
acewpcf_get_admin_page_url(
array(
'acewpcf_action' => 'search_edit',
'search_id' => $sanitized_search['id'],
'acewpcf_notice' => 'search_saved',
)
)
);
exit;
}
add_action( 'admin_post_acewpcf_save_content_search', 'acewpcf_handle_content_search_save' );
function acewpcf_get_admin_content_search_taxonomy_choices() {
$choices = array();
foreach ( acewpcf_get_admin_content_taxonomy_map() as $taxonomies ) {
if ( ! is_array( $taxonomies ) ) {
continue;
}
foreach ( $taxonomies as $taxonomy_key => $taxonomy_label ) {
$taxonomy_key = sanitize_key( (string) $taxonomy_key );
if ( '' === $taxonomy_key || isset( $choices[ $taxonomy_key ] ) ) {
continue;
}
$choices[ $taxonomy_key ] = $taxonomy_label;
}
}
return $choices;
}
function acewpcf_render_content_search_list( $content_searches ) {
$content_searches = is_array( $content_searches ) ? $content_searches : array();
?>