WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Sitewide Tags Pages
suggestion for filter (9 posts)

  1. Dwenaus
    Member
    Posted 2 years ago #

    i really like this plugin, it's very helpful. to make it even more flexible can you please add in a filter right before you add the post. on line 398 please consider adding:

    if ( apply_filters( 'sitewide_tags_add_post', true, $post ) == false )
    		return;

    or something more elegant. that way I can check if a post has this or that before the plugin copies it over. many thanks.

    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    The easy way you can do that now is hook save_post at priority 9, check the post & if you don't want it to publish, add a filter the SWT settings and turn it off for that post.

  3. Dwenaus
    Member
    Posted 2 years ago #

    that is helpful. but how do I know the save post is happening from within this plugin? Is there a downside to adding the filter. now that I think about it more, perhaps the filter should not be just for true, but it should be for the post itself, that way people could alter the post, add stuff, change it, etc. using your cool plugin. this is the second time I've needed to hack your plugin because not enough action or filter hooks exits. luckily you don't update it that often! thanks so much.

  4. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    SWT uses the save_post hook to copy the post to the tags blog.

    The filter you need to add in your plugin is pre_site_option_sitewide_tags_blog.

  5. brbrbr
    Member
    Posted 2 years ago #

    old topic but seems to adres my issue.

    i would like to trim the post like an excerpt before it's saved to the tags-blog.

    you suggest to use pre_site_option_sitewide_tags_blog but this one fires before the plugin is loaded?

  6. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    i would like to trim the post like an excerpt before it's saved to the tags-blog.

    you suggest to use pre_site_option_sitewide_tags_blog but this one fires before the plugin is loaded?

    No, I didn't suggest the filter for that purpose.

    To do what you are describing, you'll have to write your own post handling function. There is nothing in SWT that makes any changes to the post content.

    With SWT if you want to limit what's displayed on the tags blog you do that in the theme used on the tags blog.

  7. brbrbr
    Member
    Posted 2 years ago #

    right,

    A filter action on the post en the global meta would help.

    to modify the permalink for example to the correct mapped domain

    I could set a content filter before the output, however i prefer to have the content trimmed before it's copied.

  8. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    You missed what I said in the second paragraph:

    To do what you are describing, you'll have to write your own post handling function.

  9. brbrbr
    Member
    Posted 2 years ago #

    hi,

    didn't mis your remark about the post-handling function. Adding one to the theme is not my prefered option.

    I can't add a filter to the save post because that one would fire for any post. So to be able to alter the content of the post I would need a filter like swt_save_post applied just before the call the wp_inster_post

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic