Title: Conditional Posting Not Working
Last modified: April 1, 2025

---

# Conditional Posting Not Working

 *  Resolved [toad78](https://wordpress.org/support/users/toad78/)
 * (@toad78)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/conditional-posting-not-working/)
 * We’ve adopted a site from a client that was fully custom coded with ACF. While
   I’m familiar with some of ACFs code, I’m trying to create a condition to where
   the header logo will change based upon the _Practice Area Type_:
    1. The site came with a created “_Practice Areas_” (Post Type) and “_Practice Areas
       Types_” (Taxonomy) Field Groups.
    2. The _Practice Areas_ are associated with the _Practice Area Type_. There are
       34 _Practice Area Types_.
    3. I have created five logos. These logos should post only if they are based on
       a specific _Practice Area Type_. If none of them fit the condition, then there
       is a default logo that should post.
       My code:
 *     ```wp-block-code
       				<?php 					$taxonomies = get_terms( array(						'taxonomy' => 'practice-areas-types',						'hide_empty' => true					) );					if ( !empty($taxonomies) ) :					foreach( $taxonomies as $category ) { 					$termId = $category->term_id;										if ( $category->name == 'Data Breaches' ) :					echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/data-breach-attorneys.png" alt="Sacramento Data Breaches Lawyer Arnold Law Firm"></a>';						break;				elseif ( $category->name == 'Personal Injury' ) :					echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/accident-injury-attorneys.png" alt="Sacramento Personal Injury Lawyer Arnold Law Firm"></a>';						break;   	 			elseif ( $category->name == 'Employment Law' ) :					echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/employment-attorneys.png" alt="Sacramento Employment Lawyer Arnold Law Firm"></a>';						break;				elseif ( $category->name == 'Class Action' ) :					echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/class-action-attorneys.png" alt="Sacramento Class Action Attorneys Arnold Law Firm"></a>';						break;				else:					echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2017/arnold-logo-new.svg" alt="Sacramento injury lawyer Arnold Law Firm"></a>';				endif;					}			endif;				?>
       ```
   
 * The end result is: the only image posting on ALL of the Posts is the “Personal
   Injury” image (even on NON “Personal Injury” Posts). So if I was on a Post that
   fell under the “Data Breach” _Practice Area Type_, it’s posting the wrong image.
 * So I’m not sure where I’m going wrong on attempting to get the conditions to 
   work correctly, but I would appreciate some feedback (hopefully this week?).
 * Thank you!

Viewing 1 replies (of 1 total)

 *  Plugin Support [ACF Support](https://wordpress.org/support/users/acfsupport/)
 * (@acfsupport)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/conditional-posting-not-working/#post-18402273)
 * Hi [@toad78](https://wordpress.org/support/users/toad78/)
 * ACF Support Team here. This forum is generally used by ACF users to help each
   other out. 
 * However, we would love to continue investigating and troubleshooting this issue,
   please can you create a ticket using our [​support form](https://www.advancedcustomfields.com/contact/)
   and we can look into it further.

Viewing 1 replies (of 1 total)

The topic ‘Conditional Posting Not Working’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3207824)
 * [Advanced Custom Fields (ACF®)](https://wordpress.org/plugins/advanced-custom-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [ACF Support](https://wordpress.org/support/users/acfsupport/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/conditional-posting-not-working/#post-18402273)
 * Status: resolved