LinkedIn WordPress Plugin自动发布分类筛选异常问题求助
Hey JennC, sorry to hear you hit this snag with the LinkedIn WordPress plugin—let’s work through this to get it only pushing posts from your chosen category. Here are some actionable steps to fix this:
1. Double-Check & Reset Plugin Settings
First, let’s rule out a simple settings glitch:
- Head back to the plugin’s Select categories for auto publish settings.
- Uncheck your target category, click Save Changes, then re-check it and save again. This ensures the setting is properly stored in your database, not just stuck in a cached state.
- If your site uses a caching plugin (like WP Rocket or W3 Total Cache), clear the site-wide cache after saving the plugin settings. Cached configurations can sometimes override your latest changes.
2. Disable "Catch-Up" Publishing (If Available)
Some plugins include a hidden or explicit option to publish existing posts when first activated. Keep an eye out for settings like:
- Publish existing posts to LinkedIn
- Backdate auto-publish for past content
If you find this option, make sure it’s disabled. This is the most likely culprit for why both your target and non-target posts got published on the first run.
3. Add a Custom Code Filter (For Plugin Bugs)
If the plugin’s built-in category filter is broken, you can force it to only publish your target category with a quick code snippet. This uses WordPress hooks to override the plugin’s behavior:
- Use the
wp_linkedin_publish_postfilter (supported by most LinkedIn WordPress plugins) to check a post’s category before allowing it to publish. - Replace
your-target-categoryin the code below with your category’s slug or ID:
add_filter('wp_linkedin_publish_post', 'restrict_linkedin_to_target_category', 10, 2); function restrict_linkedin_to_target_category($allow_publish, $post_id) { // Define your target category (slug or ID) $target_category = 'your-target-category'; // Check if the post belongs to the target category if (has_category($target_category, $post_id)) { return true; // Allow publishing } else { return false; // Block publishing } }
- Add this code to your theme’s
functions.phpfile (use a child theme to avoid losing changes on theme updates) or use a plugin like Code Snippets to safely add custom code without editing theme files directly.
4. Update the Plugin & Test New Posts
- Make sure you’re running the latest version of the LinkedIn WordPress plugin. Old versions often include bug fixes for category filtering issues.
- Publish two test posts: one in your target category, one in a different category. If the plugin only publishes the target category post, the initial issue was likely a one-time sync glitch when you first set up the plugin.
5. Check for Plugin Conflicts
Rarely, other plugins (like category management or auto-publish tools) can interfere with the LinkedIn plugin’s filtering. To test:
- Temporarily deactivate all other plugins except the LinkedIn one.
- Publish a test non-target category post—if it doesn’t get published, reactivate plugins one by one to identify the conflicting tool.
内容的提问来源于stack exchange,提问作者JennC

