WordPress.org

Ready to get started?Download WordPress

Forums

What's the best way to do a multi-site post query without a plugin?! (16 posts)

  1. radchad
    Member
    Posted 2 years ago #

    Hello Everyone,

    Intro:
    First I will say I have spent almost a week on this problem which I thought was going to be done days ago. I have searched google, I have tried plugins, I have have tried custom mysql queries, I have tried every possible thing I can think of. If you can help here my appreciation is beyond grateful.

    The Environment:
    I have a multisite network with 2 blogs. It is very easy to use the switch to blog function to do a single query exclusively from the other blog and to output the results.

    The Current Issue
    However recently I got a request to do a query that pulls from both blogs simultaneously based on identical category names and outputs the posts from both blogs onto a single blog. Sounds simple enough right?

    I can't seem to figure out why I can't I find any documentation any where online to do this simple task with code? I am not interested in using plugins as I have already tried a few and they either do not work for my needs, or are not functioning as advertised on my wordpress network. Unfortunately I cannot afford to invest any more time to trouble shoot plugins or compatibility with my multisite network and particular plugins because I have already lost a week, and I imagine something simple like this should be doable via code.

    One of the selling points of multisite I was so happy about is I heard that it makes it easy to share content between blogs. This has to have a simple enough solution.

    Can anyone help?! If so I will be forever grateful.

    Thanks!

  2. The words 'without a plugin' will bring you a lot of eyerolling, becuase the difference between a plugin and your own code is just how it's implimented and by whom.

    One of the selling points of multisite I was so happy about is I heard that it makes it easy to share content between blogs.

    Who's saying that? That's not a selling point nor is it really accurate. Multisite is to create multiple separate site. Content is not shared between blogs by default, nor is it actually 'easy' to do.

    The easiest way to put all posts from all blogs on one blog is to use a plugin. Because it's not simple code. It's crazy complex.

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

  3. radchad
    Member
    Posted 2 years ago #

    Hi Ipstenu,

    Thanks for the response :).

    The person who told me and the organization I work for that Multi-site makes it easy to share posts between blogs was the WordPress consultant who we paid over 20,000$ to create our multi-site network, and 2 sites. This consultant also bailed in the middle of the project which has left us, (mostly me)the opportunity to complete the project in the last year :). I have actually been very grateful for this opportunity and thus far have been able to manage wordpress great, learning and implementing all sorts of things. This particular issue has been the first road block thus far.

    Unfortunately it doesn't surprise that our old consultant wasn't transparent with us on Multisite's functionality, as he has had a record of telling us what we wanted to hear just to make the sale... unfortunately we believed him. I was wondering why him and his team minimally touched the sharing content between blogs in our implementation.

    None the less the show must go on.

    Thanks for the clarity on how people may perceive the "without a plugin" sentence. This makes sense, and I can understand where people may make that interpretation. I personally have no preference between code and plugin. I'm more in the whatever works camp of philosophy. My problem is the "wordpress mu sitewide tags" plugin has not worked for my development or live environment. It either will not populate posts or will only populate like 300 posts then stop short. I'd love to use this plugin if it worked for me.

    I am hoping this is not the only solution and someone has the magic code to do a content share between blogs, but if that is the only option I will make due with it.

    Thanks again for your help Ipstenu!

  4. *siiigh* I'm sorry that consultant mislead you! I've run into my share of yes men like that :/

    That plugin, however, is the best one to use for that. The other options are all fairly server intensive. How many posts are you trying to populate into the tags blog?

  5. radchad
    Member
    Posted 2 years ago #

    thank you and i appreciate your empathy :). those type of men do exist unfortunately. on the positive note it's given me a great opportunity to learn wordpress in a live environment :).

    with regards to number of posts we don't need that many posts at all.

    there are a total of 7-8 unique pages that display 4 unique posts per page based on a unique category query that is ordered by descending date. so basically the newest total 4 posts in a category from either blogs are displayed on each of the 7-8 pages pulling about 32 unique posts.

    since a plugin like wordpress mu sitewide tags would pull over posts with categories that won't fall into this query i imagine 200-300 total posts between both blogs would capture enough posts to easily fulfill the requirements of what we need to query. while in one circumstance i was able to get wordpress mu sitewide tags to pull 250-300 posts it only pulled over the posts from blog 2 and not blog 1, despite checking the "populate posts from all blogs" checkbox.

    Thanks again Ipstenu!

  6. Well you said " It either will not populate posts or will only populate like 300 posts then stop short. " so my understanding was that you already have a couple hundred posts?

    When it stops short, is it giving an error, a white page, just hanging...?

  7. radchad
    Member
    Posted 2 years ago #

    Hi Ipstenu,

    Pardon the delay on this response I had a long weekend away from all technology. However it is now Monday and I am back on the task at hand.

    Yes it will create 300 posts, however these 300 posts are only from blog 2 and I need the plugin to aggregate at least 200-300 posts from blog 1 and 2.

    When it stops short there is no error only a white screen that just hangs. This happens regardless if I set the posts to 50, 100, or 2000.

    Thanks again for all your help!

  8. How many posts total are we talking about on blog 1 and blog 2?

    I tagged this for the devs of the plugin, as I have this niggling memory about this error, but I never ran into it...

  9. radchad
    Member
    Posted 2 years ago #

    Thanks Ipstenu.

    Basically I need the plugin to aggregate at the least 200-300 posts combined from blog 1 and blog 2.

    When running in my development site after checking the All blogs checkbox and clicking populate posts it only populates about 300 posts from blog 2 and then times out on a white screen.

    However when running in my live site it's slightly different and this may be the best site to troubleshoot from since it's the one that is going to matter. After checking the All blogs checkbox and clicking populate posts on the live site it populates 0 posts and quickly takes me to a page that says that the page title is "wordpress >> error" and the content of the page says "Finished importing posts into tags blogs!". However upon looking at my tags blog I see 0 posts added.

    Thanks again to you and the devs of this plugin for your time.

  10. So .. 200 on blog2 and 100 on blog1?

    I'm asking for a reason ;) You say '200-300 combined' but then '300 from blog2', and what I want to know is "How many total posts are on blog1? How many on blog2?"

  11. radchad
    Member
    Posted 2 years ago #

    Oh ok. Gotchya, around 50/50 will work fine, so 150 on blog 1 and 150 on blog 2.

    There is about 700 total posts on blog 1 and about 900 total on blog 2.

    as mentioned in an earlier post this is what we need the content for:

    there are a total of 7-8 unique pages that display 4 unique posts per page based on a unique category query that is ordered by descending date. so basically the newest total 4 posts in a category from either blogs are displayed on each of the 7-8 pages pulling about 32 unique posts.

    So 32 total unique posts is not much, I think 150 from blog 1 and 150 from blog 2 should well capture the unique 32 in the specific categories we need.

    Does this help?

    Thanks again!

  12. The plugin was intended to pull the posts on an ongoing basis - the part about grabbing *already existing posts* is a work in progress. Ideally it should have been installed before the subsites had content.

    Then the plugin pulls the posts as they are written and there is no need to populate posts.

    That function also relies on the memory allocation of your server - too little and it hangs

  13. It is very easy to use the switch to blog function to do a single query exclusively from the other blog and to output the results.

    And it is very resource intensive, as this is an admin function and not a front-facing function.

    also have a look at:
    http://wordpress.org/extend/plugins/diamond-multisite-widgets/

  14. radchad
    Member
    Posted 2 years ago #

    Thanks for your response Andrea

    Then the plugin pulls the posts as they are written and there is no need to populate posts

    This would be an awesome way to use the plugin and work fine for our needs here. In that case we could just wait for new posts to be written and eventually the tags blog would fill up with enough posts and we'd be done. Unfortunately this function of the plugin is not working on our multi-site network either. Though we've published posts through out the day, the tags blog is still showing as 0 posts :/... But if it did work I'd be happy to work around the populate posts issue.

    And it is very resource intensive, as this is an admin function and not a front-facing function.

    I've read this before. Definitely makes sense. I see switch to blog is not ideal. I am going to look into diamond multisite widgets again and also look into if I can aggregate the posts through RSS feed. It would be a strange way to do it, however we shall see.... Thanks for all your help Andrea and Ipstenu.

  15. Unfortunately this function of the plugin is not working on our multi-site network either. Though we've published posts through out the day, the tags blog is still showing as 0 posts :/... But if it did work I'd be happy to work around the populate posts issue.

    It does work on thousands of sites. :) We just have to figure out why it;s not working on *your* site. ;)

    Are your subsites marked as private? By default the plugin does not pull posts from private sites.

  16. radchad
    Member
    Posted 2 years ago #

    Hi Andrea,

    Thanks for the response again.

    Are your subsites marked as private? By default the plugin does not pull posts from private sites.

    This is a good question. We have made no setting changes to make any of our sites private, so my thought is no. However since our sites were originally implemented by consultants I can not say with 100% certainty. I googled how to tell if your site is private but found no relevant articles. Can you tell me if there is a line of code or a config setting I should be looking for to verify if my subsite is private or not?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic