Home Forums General Issues Taxonomy field not producing result


Taxonomy field not producing result

  • Taxonomy field not producing result.

    I am using three ACF fields to create and replace the WP page title. It works in WP Admin and on my Elementor website, except ‘$make’ which is a taxonomy.

    The title as per the code below should read ‘Year Make Model’ e.g. 1957 Chevrolet Bel-Air, but it is currently producing a number for the taxonomy, reading ‘1957 12 Bel-Air’.

    My code is in functions.php as I need to change the title in Admin as well.

    Here’s my code:

    add_action(‘acf/save_post’, ‘upd_cust_post_title’, 20);
    function upd_cust_post_title($post_id) {
    $post_type = get_post_type($post_id);
    if ($post_type != ‘cars’) {
    $year = get_field(‘year’, $post_id);
    $make = get_field(‘make’, $post_id);
    $model = get_field(‘model’, $post_id);
    $post_name = sanitize_title($post_title);
    $post = array(
    ‘ID’ => $post_id,
    ‘post_name’ => $post_name,
    ‘post_title’ => $year . ” ” . $make . ” ” . $model,

    Many thanks!

    Edit: I can produce the result on the frontend using Post Terms, but the title change in Admin still has a number instead of $make. Thanks!

Viewing 1 post (of 1 total)

The topic ‘Taxonomy field not producing result’ is closed to new replies.