Get value of another column (to combine 2 columns)
-
In my CPT (media_query), I have 2 ACF fields called Organization and Organization (Common). I have no issues using CAC to get the values (if there are any) to display in the table. What I need to do is if “Organization” is empty, and “Organization (Common)” has a value, then overwrite “Organization” with the value from “Organization (Common)”. My PHP isn’t the greatest but I’m having trouble with the code below.
function myplugin_cac_column_featured_image_value( $value, $postid, $column, $post_type ) { // Organization (Common) Column if ( $column->properties->name == 'column-meta-6' && $value ) { $org_common = $value; } // Organization Column if ( $column->properties->name == 'column-meta-5' && !$value ) { $value = $org_common; } return $value; } add_filter( 'cac/column/value', 'myplugin_cac_column_featured_image_value', 10, 4 );
Any suggestions?
https://www.ads-software.com/plugins/codepress-admin-columns/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get value of another column (to combine 2 columns)’ is closed to new replies.