Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I create posts that are used just to create an index item to show an existing post has been updated. The post I create 301 redirects to the updated post. I add these index posts to the category 'Update' and this excludes the posts from the previous and next post links via a plugin (I couldn't find any other way).

Problem is on the front page and archive pages the category each post is included in is displayed. I would like to exclude 'Update' category from these links as it is just for admin purposes.

Can I add something to my functions.php file which will prevent all links to the 'Update' category archive page being displayed?

Appreciate any guidance and apologies if this is covered already under a different term / search. I have looked.

share|improve this question
    
You create posts that do nothing but redirect to other posts? Why not just sort by last updated? –  s_ha_dum Sep 15 '13 at 20:04
    
That's an option I guess (that I had never considered) but I can give the 'new' post a unique title and it stays in my index. So I upload a tutorial and post it. 6 weeks later my tutorial gets featured somewhere. I update the tutorial post with an anchor linked section and create a new post titled 'tutorial x featured by...' with a 301 redirect to the anchor linked section of the original post. Seems to work a treat with this one issue. –  Paul Brown Sep 15 '13 at 20:08
    
Seems kinda messy to me, but its your site. –  s_ha_dum Sep 15 '13 at 20:21
    
Works really well for me but its a personal blog so maybe not what a commercial blogger would do :) –  Paul Brown Sep 16 '13 at 12:40

1 Answer 1

Assuming that you are using get_categories to print the category links, there is an exclude parameter. You need to use IDs, so you will need to convert the slug with get_term_by

$cid = get_term_by('slug','update','category');
// var_dump($cid);
get_categories(
  array(
    'exclude' => $cid->term_id
  )
);
share|improve this answer
    
Great thank you. Can this be turned into a function to include in functions.php or do I need to edit template files? –  Paul Brown Sep 16 '13 at 12:39
    
It can certainly be turned into a function but I doubt there is a hook that you can use to avoid editing theme templates. That really depends on where you want the code exactly, and I don't know that. –  s_ha_dum Sep 16 '13 at 14:15
    
Thank you @s_ha_dum you've been more helpful than I could ask. I would need the code to kick in on my home page (which is a static page) and also I think probably all my archive templates because they all show the category with link in the post detail. This is my home page skipology.com (see News and App workflow) and this is one example of my category archives skipology.com/category/news - if you can provide no further guidance then no problem, I'm very grateful for your help. –  Paul Brown Sep 16 '13 at 14:49
    
What you are asking now depends on the theme and is almost certainly a template edit. The only reliable and relevant hooks are probably the_content and the_excerpt if you want to insert the links into the post body. –  s_ha_dum Sep 16 '13 at 14:54
    
Thank you very much once again. I guess it's a step too far for me. I'll just have to leave it visible for now. I think I saw a plugin somewehere which may handle it so will research that route instead. Really grateful for your help. –  Paul Brown Sep 16 '13 at 15:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.