This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Not indexing pages / user meta image

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Not indexing pages / user meta image Reply To: Not indexing pages / user meta image

#38832
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Can you please check the login details?
I may have found a possible bug in the HTML extraction, which will definitely fix the missing results with the index table engine, I think I can fix that.

For the live results, you can actually use meta field as image for post types here: https://i.imgur.com/Cytm0DY.png

For user meta, there is still a way via custom code:

add_filter( 'asp_results', 'asp_get_custom_cf_image', 10, 1 );
function asp_get_custom_cf_image( $results ) {
	$field = 'user-image-url'; // Enter the user meta field containing the image
	foreach ($results as $k=>&$r) {
		if ( $r->content_type == 'user' ) {
			$val = get_user_meta($r->id, $field, true);
			if ( !is_wp_error($val) && !empty($val) ) {
				if ( is_array($val) ) {
					$val = reset($val);
				}
				if ( $val != null && $val != "" ) {
					if ( is_numeric($val) ) {
						$im = wp_get_attachment_image_url( $val );
					} else {
						$im = $val;
					}
					$r->image = $im;
				}
			}
		}
	}
	return $results;
}

Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

In the above code change the $field name to the meta field name.