Ad

Shortcodes Are Not Properly Working Inside Of WooCommerce Endpoints

- 1 answer

I am using WP Job Manager plugin (with some addons for it) and WooCommerce. I want to combine both plugins user dashboards, so all the user functionality will be inside of a user WooCommerce my account:

  • Dashboard
  • Orders
  • Address
  • Account Details
  • (custom endpoint) Jobs
  • (custom endpoint) Bookmarks
  • (custom endpoint) Job Alerts
  • (custom endpoint) ...
  • Logout

The problem is that WP Job Manager and it's addons shortcodes are not properly working insider of WooCommerce endpoints. I suspect that it is not only related to WPJM but this is a general thing here that brakes it.

Example 1. There is a WPJM addon Job alerts. When inside of a custom endpoint I click "cleare jot alert", page reload with the form for creating an alert. When I click "Save alert" - page just reloads with the same data I entered. Alerts did not created.

I click Add alert

After submit for just reloads and no alerts created

Example 2. Action links also not working - I have a job list dashboard shortcode. It display jobs list with action like, edit, duplicate, delete... When I click any of those page just reloads without any result.

Action links not working

Overall I feel like the submitted data can not be processed by the WP Job Manager and it's addons. All those shortcodes are working properly on the usual WP pages.

Waht can be the reason?

Ad

Answer

I found this piece of code in the plugin:

public function shortcode_action_handler() {
    global $post;

    if ( is_page() && strstr( $post->post_content, '[job_alerts' ) ) {
        $this->job_alerts_handler();
    }
}

specifically this part is what stopping the pluginto continue

strstr( $post->post_content, '[job_alerts' )

After commenting this part plugin now works inside of the endpoint. Possible solutions is to remove this action. Or replace with modified one that accept WC endpoint.

Ad
source: stackoverflow.com
Ad