Title: Bobozar's Replies | WordPress.org

---

# Bobozar

  [  ](https://wordpress.org/support/users/skizzy/)

 *   [Profile](https://wordpress.org/support/users/skizzy/)
 *   [Topics Started](https://wordpress.org/support/users/skizzy/topics/)
 *   [Replies Created](https://wordpress.org/support/users/skizzy/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/skizzy/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/skizzy/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/skizzy/engagements/)
 *   [Favorites](https://wordpress.org/support/users/skizzy/favorites/)

 Search replies:

## Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Get Custom Field Value With URL Parameter](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/#post-9428860)
 * I inserted the below query code in the functions.php function
 *     ```
       global $wp_query;
       echo $wp_query->request;
       ```
   
 * And the SQL output goes like this.
 * `SELECT wpxx_posts.* FROM wpxx_posts WHERE 1=1 AND wpxx_posts.ID = 2647 AND wpxx_posts.
   post_type = 'page' ORDER BY wpxx_posts.post_date DESC SELECT wpxx_posts.* FROM
   wpxx_posts WHERE 1=1 AND wpxx_posts.ID = 2647 AND wpxx_posts.post_type = 'page'
   ORDER BY wpxx_posts.post_date DESC SELECT wpxx_posts.* FROM wpxx_posts WHERE 
   1=1 AND wpxx_posts.ID = 2647 AND wpxx_posts.post_type = 'page' ORDER BY wpxx_posts.
   post_date DESC SELECT wpxx_posts.* FROM wpxx_posts WHERE 1=1 AND wpxx_posts.ID
   = 2647 AND wpxx_posts.post_type = 'page' ORDER BY wpxx_posts.post_date DESC SELECT
   wpxx_posts.* FROM wpxx_posts WHERE 1=1 AND wpxx_posts.ID = 2647 AND wpxx_posts.
   post_type = 'page' ORDER BY wpxx_posts.post_date DESC SELECT wpxx_posts.* FROM
   wpxx_posts WHERE 1=1 AND wpxx_posts.ID = 2647 AND wpxx_posts.post_type = 'page'
   ORDER BY wpxx_posts.post_date DESC`
 * The function is:
 *     ```
       function my_pre_get_posts( $query ) {
   
       	// do not modify queries in the admin
       	if( is_admin() ) {
   
       		return $query;
   
       	}
   
   
       	// only modify queries for 'event' post type
       	//if( isset($query->query_vars['post_type'] && $query->query_vars['post_type'] == 'post')) {#
       	if( isset( $query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') {
   
       		// allow the url to alter the query
       		if( isset($_GET['country']) ) {
   
           		$query->set('meta_key', 'country');
       			$query->set('meta_value', $_GET['country']);
   
           	} 
   
   
       	}
   
       	global $wp_query;
           echo $wp_query->request;
       	// return
       	return $query;
   
       }
   
       add_action('pre_get_posts', 'my_pre_get_posts');
       ```
   
    -  This reply was modified 8 years, 11 months ago by [Bobozar](https://wordpress.org/support/users/skizzy/).
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Get Custom Field Value With URL Parameter](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/#post-9428851)
 * When I adjusted the code and inserted dnyanraja’s meta_query alternative, I got
   the below error:
 * `Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in C:\wamp64\www\\
   wp-content\themes\look\functions.php on line 20`
 * Line 20 reads:
 *     ```
       $query->set('meta_query' => array(
       ```
   
 * Main code:
 *     ```
       function my_pre_get_posts( $query ) {
   
       	// do not modify queries in the admin
       	if( is_admin() ) {
   
       		return $query;
   
       	}
   
   
       	// only modify queries for 'event' post type
       	//if( isset($query->query_vars['post_type'] && $query->query_vars['post_type'] == 'post')) {#
       	if( isset( $query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') {
   
       		// allow the url to alter the query
       		if( isset($_GET['country']) ) {
   
           		$query->set('meta_query' => array(
                      'key' => 'country',
                      'value' => $_GET[‘country’],
                      'compare' => 'LIKE'
                   )
                )
   
           	} 
       	}
   
   
       	// return
       	return $query;
   
       }
   
       add_action('pre_get_posts', 'my_pre_get_posts');
       ```
   
 * But when I changed it to the below code
 *     ```
       function my_pre_get_posts( $query ) {
   
       	// do not modify queries in the admin
       	if( is_admin() ) {
   
       		return $query;
   
       	}
   
   
       	// only modify queries for 'event' post type
       	//if( isset($query->query_vars['post_type'] && $query->query_vars['post_type'] == 'post')) {#
       	if( isset( $query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') {
   
       		// allow the url to alter the query
       		if( isset($_GET['country']) ) {
   
           		$query->set('meta_key', 'country');
       			$query->set('meta_value', $_GET['country']);
   
           	} 
   
   
       	}
   
   
       	// return
       	return $query;
   
       }
   
       add_action('pre_get_posts', 'my_pre_get_posts');
       ```
   
 * And I visited the url example.com/?country=us
 * I got ‘Sorry, Posts you requested could not be found…’
 * With this I guess it is not filtering the field.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Get Custom Field Value With URL Parameter](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/#post-9428116)
 * After trying dnyanraja’s answer, I got the error below:
 * `Fatal error: Cannot use isset() on the result of an expression (you can use "
   null !== expression" instead) in C:\wamp64\www\\wp-content\themes\look\functions.
   php on line 14`
 * On line 14, I have the below code:
 *     ```
       if( isset($query->query_vars['post_type'] && $query->query_vars['post_type'] == 'post')) {
       ```
   
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Get Custom Field Value With URL Parameter](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/get-custom-field-value-with-url-parameter/#post-9428103)
 * Thanks for your input. Can you help with a code solution. I’m not a PHP developer
   so I don’t know how to go about writing the code.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPtouch - Make your WordPress Website Mobile-Friendly] Load more entries do not work](https://wordpress.org/support/topic/load-more-entries-do-not-work/)
 *  [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/load-more-entries-do-not-work/#post-5577574)
 * Have you solved the problem?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Google AdSense Click-Fraud Monitoring Plugin] Users Clicking more than twice after setting it to 2 clicks](https://wordpress.org/support/topic/users-clicking-more-than-twice-after-setting-it-to-2-clicks/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/users-clicking-more-than-twice-after-setting-it-to-2-clicks/#post-6178537)
 * It would be nice if those features can be added on time. Thanks so much!!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Jetpack - WP Security, Backup, Speed, & Growth] wp.me shortlink not working with publicize](https://wordpress.org/support/topic/wpme-shortlink-not-working-with-publicize/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/wpme-shortlink-not-working-with-publicize/#post-6157212)
 * Hello, I followed your steps. Even before that, I deactivated Jetpack and activate
   it back again. Yet no luck.
 * I deleted Jetpack through FTP and download and put it back manually and connect
   to wordpress with another account, yet no luck!
 * Don’t know what to do again.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Google AdSense Click-Fraud Monitoring Plugin] The Save Settings Button Not Available](https://wordpress.org/support/topic/the-save-settings-button-not-available/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/the-save-settings-button-not-available/#post-5887188)
 * F12 is not poping up anything, so I can’t check any lines. I’ve sent you a mail.
   Kindly check it out.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Google AdSense Click-Fraud Monitoring Plugin] The Save Settings Button Not Available](https://wordpress.org/support/topic/the-save-settings-button-not-available/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/the-save-settings-button-not-available/#post-5887167)
 * Yeah. I’m suing Smart mag theme [http://themeforest.net/item/smartmag-responsive-retina-wordpress-magazine/6652608](http://themeforest.net/item/smartmag-responsive-retina-wordpress-magazine/6652608).
   In my local server, I can see the button, but on my online server, I can’t find
   it.
 *   Forum: [Your WordPress](https://wordpress.org/support/forum/your-wordpress/)
   
   In reply to: [Help a newbie out!](https://wordpress.org/support/topic/help-a-newbie-out/)
 *  Thread Starter [Bobozar](https://wordpress.org/support/users/skizzy/)
 * (@skizzy)
 * [16 years ago](https://wordpress.org/support/topic/help-a-newbie-out/#post-1611627)
 * Hey bro tanx let me try it nd incase i dnt get it plz gimme ur contact so dat
   we cn chat thanks

Viewing 10 replies - 1 through 10 (of 10 total)