Title: Getting errors with plugin
Last modified: January 10, 2019

---

# Getting errors with plugin

 *  Resolved [breeakpoint](https://wordpress.org/support/users/breeakpoint/)
 * (@breeakpoint)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/getting-errors-with-plugin/)
 * Getting the following errors. WordPress 5.0.3 and plugin version 8.4.06
 *     ```
       [10-Jan-2019 21:27:21 UTC] PHP Notice:  Object of class WC_DateTime could not be converted to int in C:\xampp\htdocs\wp-content\plugins\squirrly-seo\models\services\OpenGraph.php on line 164
       [10-Jan-2019 21:27:21 UTC] PHP Notice:  Object of class WC_DateTime could not be converted to int in C:\xampp\htdocs\wp-content\plugins\squirrly-seo\models\services\OpenGraph.php on line 168
       [10-Jan-2019 21:27:21 UTC] PHP Warning:  date() expects parameter 2 to be integer, object given in C:\xampp\htdocs\wp-content\plugins\squirrly-seo\models\services\OpenGraph.php on line 169
       ```
   

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

 *  Thread Starter [breeakpoint](https://wordpress.org/support/users/breeakpoint/)
 * (@breeakpoint)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/getting-errors-with-plugin/#post-11075365)
 * I think the root cause occurs on line 143 of the mentioned file.
 * $sale_price is expected to be an integer, but it is being re-assigned to a date.
   I don;t think this re-assignment should occur and the line should be removed?
 * Line 143: `$sale_price = $product->get_date_on_sale_from();`
 *  Plugin Contributor [Calin Vingan](https://wordpress.org/support/users/calinvingan/)
 * (@calinvingan)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/getting-errors-with-plugin/#post-11076842)
 * Hi,
 * Thank you for letting us know about this. Please add these lines at the line 
   144 right after the variables are set.
 *     ```
       if(is_a($sales_price_from, 'WC_DateTime')){
          $sales_price_from = $sales_price_from->getTimestamp();
       }
       if(is_a($sale_price, 'WC_DateTime')){
          $sale_price = $sale_price->getTimestamp();
       }
       ```
   
 * It should look like this from line 139:
 *     ```
       if (method_exists($product, 'get_sale_price')) {
           $sale_price = $product->get_sale_price();
           if ($sale_price > 0 && method_exists($product, 'get_date_on_sale_from')) {
               $sales_price_from = $product->get_date_on_sale_from();
               $sale_price = $product->get_date_on_sale_from();
   
               if(is_a($sales_price_from, 'WC_DateTime')){
                   $sales_price_from = $sales_price_from->getTimestamp();
               }
               if(is_a($sale_price, 'WC_DateTime')){
                   $sale_price = $sale_price->getTimestamp();
               }
           }
       }
       ```
   
 * I will add the changes in the next version of the plugin.
 * Best regards, Calin
 *  Thread Starter [breeakpoint](https://wordpress.org/support/users/breeakpoint/)
 * (@breeakpoint)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/getting-errors-with-plugin/#post-11079153)
 * Works great, thank you!

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

The topic ‘Getting errors with plugin’ is closed to new replies.

 * ![](https://ps.w.org/squirrly-seo/assets/icon-256x256.png?rev=2724476)
 * [SEO Plugin by Squirrly SEO](https://wordpress.org/plugins/squirrly-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/squirrly-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/squirrly-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/squirrly-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/squirrly-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/squirrly-seo/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [breeakpoint](https://wordpress.org/support/users/breeakpoint/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/getting-errors-with-plugin/#post-11079153)
 * Status: resolved