Seite 1 von 1

Kann mir da ein Wordpress Spezi nen Tipp geben?

Verfasst: 11.03.2012, 18:39
von S0l0ng
Also ich war im Netz auf der Suche nach einem Wordpress Plugin das einem Artikel anhand der Tags automatisch eine Kategorie zuweist. Dabei bin ich über folgenden Code gestolpert:

Code: Alles auswählen

   // Add a category to a post for each of selected tags the post already has.
   // Modify the $tag_categories array.  Use one tag name => one category name
   function mam_add_category ($post_id = 0) {
     if (!$post_id) return;
     $tag_categories = array ( // The tag names and the corresponding category name to add
       'info' => 'information',
       'INFO' => 'information',
          'search optimization' => 'SEO',
     );
     $post_tags = get_the_tags($post_id);
     foreach ($post_tags as $tag) {
       if ($tag_categories[$tag->name] ) {
         $cat_id = get_cat_ID($tag_categories[$tag->name]);
         if ($cat_id) {
           $result =  wp_set_post_terms( $post_id, $tags = $cat_id, $taxonomy = 'category', $append = true );
         }
       }
     }
   }
add_action('publish_post','mam_add_category');
?>
Leider war keine Anleitung dabei. Einer eine Idee wohin damit (wahrscheinlich irgendwo in der functions.php). Alternativ kennt vielleicht jemand von euch ein Plugin das den Job erledigt. Wie gesagt ich brauche eine Lösung um einem Artikel automatisch die passende Kategorie (bspw. nach Keywords im Titel) in die (vorhandene) passende Kategorie zuweist.

Danke schonmal für jeden Tipp

Verfasst:
von
SEO Consulting bei ABAKUS Internet Marketing
Erfahrung seit 2002
  • persönliche Betreuung
  • individuelle Beratung
  • kompetente Umsetzung

Jetzt anfragen: 0511 / 300325-0.


Verfasst: 11.03.2012, 20:04
von S0l0ng
Ok ich hab ein Plugin gefunden das genau das macht was ich will.

Wer auch eines suchen sollte: Auto assign post to category

Das kostet 6$ und erfüllt seinen Zweck

Verfasst: 29.03.2012, 01:39
von Aalex
Nutze doch das kostenlose Plugin von Sergej. Das ordnet jeweils die Artikel je nach Kategorien zu, ist wohl eher effektiver als Tags.

https://playground.ebiene.de/related-po ... ess-nativ/