Support » Fixing WordPress » Shortcode Help

  • Resolved wp_dilettante


    I am new to WordPress and do not know PHP. I recently learned about shortcodes in WP and was wondering if there is a shortcode which I can use to assign tag(s) to a post by using the shortcode from within the post content.


Viewing 4 replies - 1 through 4 (of 4 total)
  • Use this plugin:

    And this shortcode


    Thank you for the suggestion. If I understand correctly, the ‘template-tag-shortcodes’ plugin has a list of shortcodes that only get information about a post but do not assign information to it. The shortcode in the plugin called [the_tags] uses the WordPress function the_tags(). Then, according to the Codex here the shortcode will only list the tags the post already belongs to.

    What I would like to accomplish is this:
    1. Send an email to my WordPress blog.
    2. The body of the email contains a shortcode (for e.g. [set_tags a,b,c]).
    3. WordPress processes the email and publishes it as a post and assigns it tags a, b and c even if no such tags already exist.

    Which WordPress function would accomplish this? Would wp_set_post_tags() work?

    Ah! The function wp_insert_post might very well work, not only for assigning tags to the post but also assigning other information to it. Perhaps the shortcodes mentioned on the page uses this function too. Now I have to figure out how to write the appropriate shortcodes.

    Before seeing your reply I had stumbled upon the function wp_add_post_tags here on row 2018 and had written this shortcode for it:

    function wp_add_post_tags($post_id->ID, $tags=''){
           return wp_set_post_terms($post_id,$tags,'post_tag',$append);
    add_shortcode('my_tags', wp_add_post_tags)

    I had not implemented it. So I don’t know if it would even work.

    Anyway, thanks again for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode Help’ is closed to new replies.