How would i go about making it so a text field can set the posts category ?
add_action( 'acf/save_post', 'category_by_text', 10 );
function category_by_text( $post_id ) {
// Bail if not logged in or not able to post
if ( ! ( is_user_logged_in() || current_user_can('publish_posts') ) ) {
return;
}
// Bail early if no ACF data
if( empty($_POST['acf']) ) {
return;
}
// ACF image field key
$catatext = $_POST['acf']['field_551c9469b244c'];
// Bail if image field is empty
if ( empty($catatext) ) {
return;
}
// Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta( $post_id, 'category', $catatext );
}
so far i have this, but it doesn’t work. am i going about it completely wrong?
The support for this plugin is next to none, i regret buying it! what a joke.
This reply has been marked as private.