conflict with a function
-
Hello and thank you for your work on WC Vendors,
I use the following function (found on the internet), to force the listing of all of my users in the admin author dropdown, visible when editing posts.
I found out that this function conflicts with WC Vendors, which prevents from adding new products… it breaks the process when clicking on “add product”. It’s solved when changing the theme or disabling WC Vendors, that’s how I found out where it comes from. I deleted piece by piece of code in my functions.php until I could identify the one causing the issue.
Do you have an idea why this code breaks the process when WC Vendors is enabled? I’m not a developper so unfortunately I can’t understand what could be wrong between this snippet and your plugin…
Thank you so so much for your help! Have a great day,
Emilien// Filter to fix the Post Author Dropdown function author_override( $output ) { global $post, $user_ID; // return if this isn't the theme author override dropdown if (!preg_match('/post_author_override/', $output)) return $output; // return if we've already replaced the list (end recursion) if (preg_match ('/post_author_override_replaced/', $output)) return $output; // replacement call to wp_dropdown_users $output = wp_dropdown_users(array( 'echo' => 0, 'name' => 'post_author_override_replaced', 'selected' => empty($post->ID) ? $user_ID : $post->post_author, 'include_selected' => true )); // put the original name back $output = preg_replace('/post_author_override_replaced/', 'post_author_override', $output); return $output; } add_filter('wp_dropdown_users', 'author_override');
- The topic ‘conflict with a function’ is closed to new replies.