Title: Page error when plugin activated
Last modified: July 9, 2021

---

# Page error when plugin activated

 *  Resolved [curtisnew](https://wordpress.org/support/users/curtisnew/)
 * (@curtisnew)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/)
 * Hi, when i activate the plugin, pages contained a payperpost are not accessible
   with “page error”. Here the server error log:
 *     ```
       32151#0: *24 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Cannot use object of type WP_Post as array in /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/partials/shortcode-all.php:13
       Stack trace:
       #0 /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-shortcodes.php(127): require()
       #1 /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-shortcodes.php(57): Woocommerce_Pay_Per_Post_Shortcodes::shortcode_all('all', Array)
       #2 /var/www/vhosts/mysite.com/httpdocs/wp-includes/shortcodes.php(343): Woocommerce_Pay_Per_Post_Shortcodes::process_shortcode(Array, '', 'woocommerce-pay...')
       #3 [internal function]: do_shortcode_tag(Array)
       #4 /var/www/vhosts/mysite.com/httpdocs/wp-includes/shortcodes.php(218): preg_replace_callback('/\\[(\\[?)(woocom...', 'do_shortcode_ta...', '\n<h3>Voici votr...')
       #5 /var/www/vhosts/l" while reading response header from upstream
       ```
   
 * I understood that is because of the short code [woocommerce-payperpost template
   =’all’] inside the page, it crash the page. But the short code [woocommerce-payperpost
   template=’purchased’] work. So do you know why “ALL” don’t work ?
 * I use the lastest version of plugin 2.6.8, woocommerce 5.4.1 and wordpress 5.7.2.
    -  This topic was modified 4 years, 10 months ago by [curtisnew](https://wordpress.org/support/users/curtisnew/).
    -  This topic was modified 4 years, 10 months ago by [curtisnew](https://wordpress.org/support/users/curtisnew/).

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

 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/#post-14643481)
 * hey [@curtisnew](https://wordpress.org/support/users/curtisnew/)
    That is totally
   a bug. It is already fixed in version 3.0 which will be coming out this weekend.
   In the meantime goto /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-
   pay-per-post/public/partials/shortcode-all.php on line 13 and change $post[‘ID’]
   to be $post->ID
 *  Thread Starter [curtisnew](https://wordpress.org/support/users/curtisnew/)
 * (@curtisnew)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/#post-14643533)
 * this is line 13:
    `if ( Woocommerce_Pay_Per_Post_Helper::has_access( $post['post_id'])){`
   Is not the same. So what is the final result ? thanks
 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/#post-14643552)
 * Change that to be
 * `if ( Woocommerce_Pay_Per_Post_Helper::has_access( $post->ID ) ) {`
 *  Thread Starter [curtisnew](https://wordpress.org/support/users/curtisnew/)
 * (@curtisnew)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/#post-14643849)
 * Great, it works ! Thanks a lot

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

The topic ‘Page error when plugin activated’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pay-per-post/assets/icon-256x256.png?rev=2252656)
 * [Pay For Post with WooCommerce](https://wordpress.org/plugins/woocommerce-pay-per-post/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pay-per-post/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pay-per-post/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pay-per-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pay-per-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pay-per-post/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [curtisnew](https://wordpress.org/support/users/curtisnew/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/page-error-when-plugin-activated/#post-14643849)
 * Status: resolved