Skip to content

Instantly share code, notes, and snippets.

@jeffikus
Created March 3, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffikus/b7ee8f385c8ac8ba40f5 to your computer and use it in GitHub Desktop.
Save jeffikus/b7ee8f385c8ac8ba40f5 to your computer and use it in GitHub Desktop.
<?php
/**
* I am adding this within a loop
**/
$current_user = wp_get_current_user();
// This is data that we get from the users profile, its auto-populated based on three fields.
$user_filter_criteria = get_field('user_filter_criteria', 'user_'. $current_user->ID);
// This is data in a custom post type meta field that is supposed to match the above.
$filter_criteria = get_field('filter_criteria');
// $t_user_f = strtolower (trim( $user_filter_criteria ) );
// $t_f = strtolower (trim( get_field('filter_criteria' ) ) );
if ( $user_filter_criteria === $filter_criteria ) {
echo 'Its True';
} else { echo 'Its False' . var_dump($user_filter_criteria) . '' . var_dump($filter_criteria) ."\n";
}
// This is the output:string(44) "automotive services western cape west coast" string(43) "automotive services western cape west coast" Its False
// I have tried trim() and strcmp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment