Combine “Exclude” Query in functions.php

Just put both if statements with || (or) in the one callback function: function wpse_283481_exclude_posts( $query ) { if ( ( $query->is_main_query() && $query->is_home() ) || $query->is_feed() ) { $query->set( ‘cat’, ‘-103’ ); } } add_action( ‘pre_get_posts’, ‘wpse_283481_exclude_posts’ );

mysql query – how to escape apostrophe?

Use esc_html() when outputting a string value inside tags. Use esc_attr() when you’re outputting a string value inside an attribute=””. If you’re outputting a URL, use esc_url() instead of those two. if ($tenantsInfo) { foreach ($tenantsInfo as $tenant) { echo “<h2>Welcome, ” . esc_html( $tenant->tenant_name ) . “</h2>”; } }

Valid SQL query return empty

There are view issues with the query: First what the @janh wrote. Second why you removing the am/pm when you could easily use the date(“Y-m-d H:i:s”); Third, there is this little helper for the database table prefixes $wpdb->prefix Users table the column name is display_name Also when you make aliases is a good rule to … Read more

How to insert Collate into WordPress search query?

You should add the following code to the functions.php of your theme (and it is better to make all modifications in child theme): add_filter( ‘posts_search’ , ‘posts_search’ ); function posts_search( $search ) { $search = str_replace( ‘LIKE’, ‘COLLATE utf8_bin LIKE’, $search ); return $search; } It works. You can check it on my test site: … Read more

Related post based on content

I’m too low level to comment but maybe this WP guide can help you. I didn’t want to copy and paste their answer in case it was against WPSE.

how to insert missing tags into the posts through mySQL?

You should not modify the wordpress DB via SQL unless it is a total emergency. WordPress DB structure getting more complex with time and there are always possible intractions with plugins that you might bypass with direct SQL. What you should do is to write a small plugin that inserts the tags by calling using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)