Title: Specific Post Filter
Last modified: August 19, 2016

---

# Specific Post Filter

 *  [Knight Vash](https://wordpress.org/support/users/infiniteknight/)
 * (@infiniteknight)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/specific-post-filter/)
 * This is the second of two issues I have with writing my plugin…
 * I need to set a hook / action up to trigger only on posts to a specific category.
 * Since these posts would have a very specific maximum length, would it be easier
   to:
 * Setup the plugin’s admin system to accept these posts directly, assigning them
   to the right category, and acting on them directly as part of it’s code to put
   them into the DB…
 * Or
 * Set a hook or action up to trigger when a post is submitted, then have the function
   that is triggered test to see if the post is in the right category before acting
   on it, or ignoring it if it isn’t?
 * In the end, I want the posts to end up being able to be displayed like any other
   WP post, as well as part of the RSS feeds, etc, but I also want special code 
   triggered that will work in concert with an external system to relay those posts
   to another setup.
 * (And for those who ask, no, RSS isn’t a viable option for the relay, even if 
   you just pulled that specific category, there is way too much work to do for 
   RSS to be usable in this matter, the work has to be handled by PHP for it to 
   get done, as each post will trigger a large amount of interaction between WP 
   and the external system in order for both to perform their respective functions.)

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

 *  Thread Starter [Knight Vash](https://wordpress.org/support/users/infiniteknight/)
 * (@infiniteknight)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997493)
 * Bump… Still trying to get an answer to this question…
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997494)
 * I’d take the second option. Much easier. You’d only have to worry about the relay,
   not the relay _and_ post database inserts.
 *  Thread Starter [Knight Vash](https://wordpress.org/support/users/infiniteknight/)
 * (@infiniteknight)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997495)
 * The relay is the easy part… Down side is going with the second, means I have 
   to risk only being able to send part of the post along the relay… I have a maximum
   length for posts via the relay of about 768 single byte characters, as a hard
   limit of the external API I am developing around, to allow for all possible external
   factors. So that means I would have to only send parts of long posts, versus 
   being able to hard code a limit in the admin side form. From what I have seen,
   if you use the built in WP functions, adding a post isn’t a big deal, and I can
   build my relay right into the same code very easy enough. (I already have a relay
   function tucked away inside a library I include using require_once in the various
   functions where I need them.) Thanks for the vote though… Would like to get a
   couple of other answers, to see what kind of over all consensus there is.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997496)
 * Inserting a post isn’t that big of a deal but it sounds like you’d be basically
   duplicating an admin page with one minor change, if you went with option 1.
 * If you are confident that your users will have javascript enabled you ought to
   be able to cook up a script that will limit post content if and only if your 
   special category is selected.
 *  Thread Starter [Knight Vash](https://wordpress.org/support/users/infiniteknight/)
 * (@infiniteknight)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997529)
 * Umm… I rarely have JS enabled, even on my own sites, (using Firefox with No Script),
   so I don’t want to rely on the fact of users having JS turned on. I want to use
   strictly straight code, so no matter what it will operate correctly… The other
   issue would be is there a way to trigger a function to run if the category is
   selected? Going with the straight admin page, I could probably grab the excerpt,(
   which may be a bit confusing for someone to understand at first glance).

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

The topic ‘Specific Post Filter’ is closed to new replies.

 * 5 replies
 * 2 participants
 * Last reply from: [Knight Vash](https://wordpress.org/support/users/infiniteknight/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/specific-post-filter/#post-997529)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
