wordpress - get post_posts empty with ampersand in title -
i have tried below scenario, both getting empty results if post title have & () symbol,
first way,
$event_details = get_page_by_title($event_name, object, 'tribe_events');
second way,
$event_name = html_entity_decode( $event_name ); $event_details = get_page_by_title($event_name, object, 'tribe_events');
third way,
global $wpdb; $search = $wpdb->query( "select * `wp_posts` `enter code here`post_title=".$title );
fourth way,
$event_name = addslashes ( $event_name ); $event_details = get_page_by_title($event_name, object, 'tribe_events');
just use esc_attr()
title , try use esc_html()
$search = $wpdb->query( "select * `wp_posts` `enter code here`post_title='".esc_attr($title)."'" );
Comments
Post a Comment