Home Forums Front-end Issues Taxonomy image = id, not url (or object)


Taxonomy image = id, not url (or object)

  • I have created a taxonomy field of type image (field group is displayed on a taxonomy, posttags. The return type of the image field is URL, but when I check the database, it has saved the ID. Data is also saved under termmeta.

    How can I save the image URL insted of the ID?
    I cannot retrieve any images from this field (I use Elementor – not code)

  • ACF only saves the image ID. You cannot use an ACF field to save the URL in the DB.

    If you really must have the url stored in the DB then

    add_action('acf/save_post', 'add_image_url_for_acf_image_field', 20);
    add_image_url_for_acf_image_field($post_id) {
      // get the acf field, assuming it is set to return the url
      if (substr($post_id, 0, 5) != 'term_') {
        // not a term
      $term_id = intval(substr($post_id, 5));
      $image = get_field('your-image-field-name', $post_id);
      if ($image) {
        // not the different meta_name value
        update_term_meta($term_id , 'your-image-field-name-url', $value);

    Then instead of using the acf function get_field() you use get_term_meta()

  • Ok. I don’t use code to retrieve the value, but Elementor. Usually, Elementor is able to grab the image, and it is for pages, categories and post, but not when it is connected to taxonomies.

    I tried to change the ID to an url in one of the fields in the db, but it didn’t make much of a difference.

  • You should try to get support from Elementor

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.