Markiere Beiträge, die von WordPress zu Discourse veröffentlicht werden

Posts can now be tagged when they are published with the WP Discourse plugin. To tag a post, click on the Discourse meta box Advanced Options link to expand the meta box. Add tags to the Tag input, either one at a time, or as a comma separated list.

Any spaces in tag names will be converted to hyphens. The maximum number of tags is set by the ‘Maximum Number of Tags’ option found on the Publishing Settings tab. The maximum number of tags will default to 5 if the setting is left empty. Tags that are not allowed on Discourse due to Site Setting or category restrictions will be omitted when the post is published to Discourse.

7 „Gefällt mir“

Is there a way to hook into this to prepopulate specific custom post types with specific tags?

1 „Gefällt mir“

The WP DIscourse plugin doesn’t have a hook that can be used to automatically add tags to a post before it gets published to Discourse. I’ll add a hook for that can be used for this and let you know when that has been done.

4 „Gefällt mir“

Entschuldigen Sie, dass ich einen so alten Beitrag wiederbelebe, aber wurde dies hinzugefügt? Ich habe versucht, den Quellcode zu durchsuchen, konnte aber nichts finden.

2 „Gefällt mir“

Wir haben diesen Hook noch nicht hinzugefügt. Ich werde ihn in der nächsten Version hinzufügen :+1:

2 „Gefällt mir“

Es sind 2 Jahre :open_mouth: das hätte schon vor Ewigkeiten hinzugefügt werden sollen :laughing:

Nein, nur ein Scherz, danke im Voraus :slight_smile: :+1:

1 „Gefällt mir“

Hallo, ich sehe, dass eine neue Version erstellt wurde. Wurde dies hinzugefügt?

Nein, diese Veröffentlichung betraf ein anderes, spezifisches Problem. Ich werde sicherstellen, dass es in der nächsten enthalten ist.

Sie können den wpc_publish_body-Filter verwenden, um dies zu erreichen, z. B.

add_filter(  'wpdc_publish_body', function( $body, $remote_post_type, $post_id ) {
   if ( 'create_post' === $remote_post_type ) {
      $body['tags'] = array( 'tag1', 'tag2' );
   }
   return $body;
}, 10, 3);

2.4.5 fügt post_id als Parameter zum Filter hinzu, um den spezifischen Fall des Hinzufügens von Tags zu Beiträgen bestimmter Typen zu erleichtern.

2 „Gefällt mir“