Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing WordPress permalinks breaks old BuddyPress activity updates links

  • Avatar of dvd3141
    David Hunt
    Participant

    @dvd3141

    If I change the permalinks setting in WordPress Settings / Permalinks, then all previous BuddyPress activity updates become broken. For example, “Joe Bloggs wrote a new post ‘New Post’ — the link to New Post still uses the old permalinks structure, and results in a 404 error.

    Anyone else seen this happen? Is there a simple fix?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    Yes, the activity stream items are created at the time a post is created, so the bug is explicable. Surprised it’s not been encountered before ( @djpaul – have you noticed this previously? ).

    I suspect the best solution is to store the links in the activity stream in a ‘permalink neutral’ way, and then apply a filter that ‘adds’ the current permalink structure to them when they are displayed / accessed.

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    I can’t find a ticket, but I’m pretty sure it’s come up before somewhere — probably buried in the depths of trac…

    Roger’s solution would be to modify Post and Page activity items to link to the ?p=… link format; those do a canonical redirect to the “real” URL, so such a change wouldn’t affect search engines.

    However, we’ve finished work on BP 1.6. We’re going to put out a release candidate very very soon, so this issue would have to be considered for a future version of BuddyPress.

    @dvd3141 If you can make an enhancement ticket on https://buddypress.trac.wordpress.org/ so this isn’t forgotten about please. :)

    Avatar of dvd3141
    David Hunt
    Participant

    @dvd3141

    Thanks for confirming I wasn’t doing anything silly. :)

    Ticket posted: https://buddypress.trac.wordpress.org/ticket/4367

    (I set it as a bug rather than enhancement, because I genuinely believe this would be a big problem anytime anyone decides the change their permalink structure.)

    Avatar of sammyb
    sammyb
    Participant

    @sammyb

    I just had a look at the ticket but was unable to comment on it, so I will post my comment here instead.

    The idea of using the ?p= links is not ideal as a redirect will have to be performed for each link, also for SEO it is far better to have the correct links on the page instead of links that rely on redirect.

    My suggestion for posts activity items would be: instead of storing a URL / permalink for each posts activity, why not just store the post ID? – that way you can let the wordpress native function (post_permalink) generate the permalink and no matter how many times you change the permalink settings buddypress activity will instantly link to the correct URLs.

    Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    It was built the way it was because of architectural reasons. It’s something we want to change, it’s just as simple as no-one’s done it yet.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.