How can I use a WP Custom Rewrite to remove part of a slug, like how php's explode() works?

I want to have these URLs:

/reports/biotech/deals/
/reports/retail/deals/
/reports/finance/deals/

where

  • "reports" is my Custom Post Type rewrite slug,
  • the industries ("biotech", "retai", and "finance") are terms of my Custom Taxonomy (I already have a function to add them to the permalink),
  • "deals" is the re-written slug that I'm asking about now.

But since slugs must be unique, I can't just type in "deals" for all three posts. I'd need something like:

  • deals-1
  • deals-2
  • deals-3

So I'm looking for a way to remove the suffixes (the "-1", "-2", and "-3" parts) from each slug, as displayed to the user in the url. In php, I would say

$slug_array = explode('-',$slug);
$slug = $slug_array[0] . "/" ;

But I don't know how to accomplish this with Rewrites.

Any help much appreciated!

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.