Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Dokan support
- */
- function pm_dokan_support() {
- global $post, $wp_query, $wp;
- // Check if Dokan is activated
- if(!function_exists('dokan_get_option')) { return; }
- // Get Dokan dashboard page id
- $dashboard_page = dokan_get_option('dashboard', 'dokan_pages');
- // Stop the redirect
- if(!empty($dashboard_page) && !empty($post->ID) && ($post->ID == $dashboard_page)) {
- $wp->query_vars['do_not_redirect'] = 1;
- // Detect dokan shortcode
- if(empty($wp_query->query_vars['edit-account'])) {
- $wp->query_vars['page'] = 1;
- }
- }
- // 2. Support "Edit Product" pages
- if(isset($wp_query->query_vars['edit'])) {
- $wp_query->query_vars['edit'] = 1;
- $wp_query->query_vars['do_not_redirect'] = 1;
- }
- }
- add_action('wp', 'pm_dokan_support', 999);
- function pm_extra_dokan_endpoints($endpoints) {
- $endpoints .= "|edit";
- return $endpoints;
- }
- add_filter('permalink-manager-endpoints', 'pm_extra_dokan_endpoints');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement