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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -