Title: Tony Law's Replies | WordPress.org

---

# Tony Law

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

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

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/users/lbtdev/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/lbtdev/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13130459)
 * [@keraweb](https://wordpress.org/support/users/keraweb/) No problem. Yes it does
   seem very strange!
 * MySQL Version: 5.7.25
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13126424)
 * As far as I know it’s the latest version of MySql.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13125847)
 * [@keraweb](https://wordpress.org/support/users/keraweb/) Thanks for your help.
 * I have run this directly against the SQL database and hacked around with the 
   query. Turns out that there are spaces in the built query which my DB version
   didn’t like. Removing these fixed the issue!
 * I amended the following params to remove the spaces between and it now works.
 *     ```
       	if($selectedCat){
       		$params = array(        
       			'where' => 'workshop_category.meta_value="' . $_GET["STEMCat"] . '"',
       			'limit' => -1, 
       		);
       	} else {
       		$params = array(        
       			'limit' => -1, 
       		);
       	}
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13125454)
 * [@keraweb](https://wordpress.org/support/users/keraweb/) thank you. Yes, I can’t
   see any issue with it and I’ve tried several different itterations with no success.
 * The debug trace came back with:
 * Database Error; SQL: SELECT DISTINCT `t`.* FROM `vrw_posts` AS `t` LEFT JOIN `
   vrw_postmeta` AS `workshop_category` ON `workshop_category`.`meta_key` = ‘workshop_category’
   AND `workshop_category`.`post_id` = `t`.`ID` WHERE ( ( `workshop_category`.`meta_value`
   = ‘E’ ) AND ( `t`.`post_type` = “primary-workshop” ) AND ( `t`.`post_status` 
   IN ( “publish” ) ) ) ORDER BY `t`.`menu_order`, `t`.`post_title`, `t`.`post_date`;
   Response: You have an error in your SQL syntax; check the manual that corresponds
   to your MySQL server version for the right syntax to use near ‘ = ‘E’ ) AND (`
   t`.`post_type` = “primary-workshop” ) AND ( `t`.`post_status` I’ at line 11
 * Adding t. before workshop_category give me an unknown coulmn error. So it looks
   as though I’m looking in the right place. I have tried escaping the string via\
   as well as using the PHP functions to escape the strings, I have also tried string
   interpolation but always get this syntax error
    -  This reply was modified 5 years, 11 months ago by [Tony Law](https://wordpress.org/support/users/lbtdev/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13123767)
 * It’s a plain meta value. Setup as a field in the POD:
    Field Type: Relationship
   Related To: Simple Custom Defined Types: S|Science T|Technology E|Engineering
   M|Maths
 * It’s a singular dropdown list and I am using the value to evaluate against the
   querystring (?STEMCat=x)
 * if it helps, my updated code is:
 *     ```
       	$selectedCat = $_GET["STEMCat"];
   
       	if($selectedCat){
       		$params = array(        
       			'where'   => "workshop_category.meta_value = '" . $selectedCat . "'",
       			'limit'   => -1, 
       		);
       	} else {
       		$params = array(        
       			'limit'   => -1, 
       		);
       	}
   
           $PWpod = pods('primary-workshop')->find($params);
       ```
   
 * Thanks in advance
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pods - Custom Content Types and Fields] Shortcode with Where clause default value](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/shortcode-with-where-clause-default-value/#post-13122070)
 * Hi Jory. Thanks for thre quick response. I figured this would be the case, but
   thought I’d check as the same concept in something like .net where the where 
   clause would read …meta_value = ” would yield all results instead of no results.
 * Anyway
 * I have now created a page template for this and it’s running fine, until I add
   the where clause and then I get a SQL syntax error. If I include t. before the
   field name then I get an unknown column error, so I think the column name is 
   correct and as far as I can see everything else should be fine. I have tried 
   swicthing the ” and ‘ around as well as using ` but nothing seems to work.
 *  My code is below:
 *     ```
           $var = "S"; // Placeholder for the moment. Replace with querystring val when working
           $params = array(        
       		'limit'   => -1, 
       		'where'   => 'workshop_category.meta_value = "' . $var . '"' //Works with this line taken out
       	);
   
           $PWpod = pods('primary-workshop',$params);
   
           if ( $PWpod->total() > 0 ) {...
       ```
   
 * This works when I take out the where clause (S is a known valid value). I’ve 
   looked through several posts and tried several different itterations of this 
   including with and with out the ‘t.’ and using LIKE but I still get the same 
   error.
 * My shortcode this is dervied from is: `[pods name=”primary-workshop” template
   =”Primary Workshops” where=”workshop_category.meta_value = ‘{@get.STEMCat}'”]`
 * Please advise.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Memphis Documents Library] Open PDFs in browser instead of downloading](https://wordpress.org/support/topic/open-pdfs-in-browser-instead-of-downloading/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/open-pdfs-in-browser-instead-of-downloading/#post-11744828)
 * Perfect, thank you
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Memphis Documents Library] Hide mdocs-posts page](https://wordpress.org/support/topic/hide-mdocs-posts-page/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/hide-mdocs-posts-page/#post-11648473)
 * That did nothing unfortunately. I ended up writing a redirect for mdocs-posts
   to the main homepage
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Multiple Domain Mapping on Single Site] Works perfectly with http, but not https](https://wordpress.org/support/topic/works-perfectly-with-http-but-not-https/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/works-perfectly-with-http-but-not-https/#post-11189224)
 * Tried on a fresh instance of Chrome and it worked, so this appears to be a caching
   issue with the individual browser. Looks like it’s working fine now.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Multiple Domain Mapping on Single Site] Works perfectly with http, but not https](https://wordpress.org/support/topic/works-perfectly-with-http-but-not-https/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/works-perfectly-with-http-but-not-https/#post-11189071)
 * I have worked on this a little more and the issue only presents on Chrome now.
   All other browsers are fine. I have tried clearing my cache but it has had no
   effect. Please advise.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Simple Event Planner] Restrict search to certain fields?](https://wordpress.org/support/topic/restrict-search-to-certain-fields/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/restrict-search-to-certain-fields/#post-10505147)
 * Ah! I had a plugin which was modifying the search! Disabled and now I can see
   it’s using title only.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Simple Event Planner] Restrict search to certain fields?](https://wordpress.org/support/topic/restrict-search-to-certain-fields/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/restrict-search-to-certain-fields/#post-10504997)
 * Thanks.
 * Thats interesting. The filter doesn’t seem to be working as it’s definitely searching
   on more than just the event title. I’m getting results where the search criteria
   appears in the body as well.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Simple Event Planner] Restrict search to certain fields?](https://wordpress.org/support/topic/restrict-search-to-certain-fields/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/restrict-search-to-certain-fields/#post-10504116)
 * Thanks for the reply.
 * I am a web developer, so do understand code. However, I can’t seem to find the
   functions that carry out the search. Can you please point me in the right direction
   to amend the code please.
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Simple Event Planner] Fields names?](https://wordpress.org/support/topic/fields-names/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/fields-names/#post-10201600)
 * Either way, my data is now in and working fine. Thank you for your help
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Simple Event Planner] Fields names?](https://wordpress.org/support/topic/fields-names/)
 *  Thread Starter [Tony Law](https://wordpress.org/support/users/lbtdev/)
 * (@lbtdev)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/fields-names/#post-10201364)
 * Thats odd. The start_date has imported correctly, however it is sowing as 1st
   January 1970 on the front end. If I go into the event in the admin and just click
   save, the correct date is then displayed.

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/users/lbtdev/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/lbtdev/replies/page/2/?output_format=md)