Cyril, thank you so much for your response. I should have just put in my code first, and will here below. I attempted your strpos function method, and then another function strpbrk from the link that you gave me. The problem with both is that they are both looking for a string when in fact I am feeding them an array. I get this error:
Warning: strpos() expects parameter 1 to be string, array given
Here is my code. Again to explain, the top portion is simply getting all my pages to list using ‘normal’ WordPress functions without using a db query. The bottom portion, from the $keys_to_show variable on down, is the bit that I’m trying to figure out. Being totally candid, I am worthless at PHP and pieced this together from trial and error, but it works. I left the strpos line in there that is giving me the error–maybe I’m putting it in the wrong place? Maybe there isn’t a function that looks through arrays?
<?php
$mypages = get_pages( array( 'child_of' => 8, 'sort_column' => 'post_title', 'sort_order' => 'ASC' ) );
foreach( $mypages as $page ) { ?>
<div class="document-page-result">
<h5><a href="<?php echo get_page_link($page); ?>"><?php echo $page->post_title; ?></a></h5>
<?php $meta_values = get_post_meta($page->ID);
$keys_to_show = array('custom_field_key_1', 'custom_field_key_2', 'custom_field_key_3','custom_field_key_4', 'custom_field_key_5'); // array of keys to show
if (strpos( $keys_to_show, '<a' ) !== false ); {
foreach ($keys_to_show as $key) {
if( array_key_exists($key, $meta_values) ) {
$values = $meta_values[$key];
foreach ($values as $value) {
echo "$value<br />";
}
}
}
}
?>
</div>
<?php } ?>
Getting back to the original problem/question–attempting to look through all the custom field keys and only display the ones that are links, instead of all of them like it is doing now. Thanks again in advance, I genuinely appreciate it.