• Plugin Author Chester McLaughlin

    (@chetmac)


    If your VirtualPosts were returning 404s even when your VirtualPost config test returned records, the latest update should fix it.

    I recently found and worked around an issue that was caused by plugins/themes that used the “flush_rewrite_rules()” method when is_admin() == false.

    Simply put, flushing the rewrite rules should only happen when an admin has triggered it by activating, deactivating, or configuring a plugin. Some plugins and themes (Gravity Forms to name one) run a check of the rewrite rules on *every page load* for their expected rewrite rules and if they’re not found, add them, and then flush the rules.

    This approach means that *every plugin author* who doesn’t want to have their rewrite rules wiped out must add them on every page load. Now, this isn’t a huge performance hit, but it would be unnecessary if others followed best practices.

    Rest assured that Airpress is NOT calling flush_rewrite_rules() on every page load… it’s just calling the required add_rewrite_rule on every page load *just in case* some other plugin calls “flush_rewrite_rules()” on the “frontend”.

    Hope this helps some of y’all!

Viewing 15 replies - 1 through 15 (of 15 total)
  • Unfortunately I’m getting 404s after updating to 1.1.60. I tried rolling back to an earlier version but it’s creating some sort of permalink error and I’ve had to disable the plugin.

    When the plugin is active, my homepage works but none of my second-level pages can be accessed (not just airpress/virtual posts/pages, but all pages and posts on my website). When I deactivate the plugin, and reset permalinks, then they are live again (but only after I reset permalinks). Resetting permalinks while the plugin is active has no effect.

    I thought from what you’ve written above that it might be some sort of plugin conflict but I deactivated every other plugin and just activated Airpress and it’s still happening. I guess it could be related to my theme, which would be more of a problem.

    Any ideas on what else I could try?

    Great plugin by the way – I hope I can get it working again. I think I should be able to restore from backup but I thought I’d reach out with what’s happening before I did that after noticing this may be related to the update.

    Plugin Author Chester McLaughlin

    (@chetmac)

    I’ll check it out now…

    Plugin Author Chester McLaughlin

    (@chetmac)

    I don’t see any issues on my sites that use Airpress, so I’m thinking that one of your regular expressions is being too greedy.

    Install the “rewrite-rules-inspector” plugin so you can see exactly which rewrite rule is “grabbing” your pages.

    Also, can you copy paste the value for the “URL Pattern to Match” field for each VirtualPost you have configured?

    Lastly can you verify that you have no VirtualField configurations setup?

    If you send me your contact info via https://chetmac.com/contact I can also reach out and maybe do a screenshare to dig a littler deeper if need be.

    Thanks for the quick reply.

    The Rewrite Rules Inspector returned this: (.?.+?)(?:/([0-9]+))?/?$’ => ‘index.php?pagename=$matches[1]&page=$matches[2] – I’m no good on RegEx (or php for that matter!) but it seems to be grabbing every URL I test.

    The three virtual post URL patterns are:
    ^mlist/([^/]+)/?$
    ^mat/(.*)/?
    ^matlist/?$
    (I had no idea what I was doing – I was just cobbling things together from your videos and this forum – I only had two pages so I don’t think I was using three all of those but I’m not sure now which ones were working).

    I may have had a VirtualField configuration setup (I played around a bit when I first installed and I can’t be sure I deleted it).

    I’ll re-activate the plugin and do some more digging and report back or reach out via your contact page. Thanks for your help.

    • This reply was modified 6 years, 3 months ago by pledford.

    I’m having the exact same issue, my Virtual Posts stop working. I can activate the plugin after resetting my permalinks, and the Virtual Fields will start working, but the posts wont. Once I try to re-save even one of the Virtual Posts, all web pages except the home page give me a 404 even the ones not generated by Airpress.

    Sorry to hear you’re having the same issue @moochie – I haven’t had a chance to look any further into my problem so I haven’t yet reached out to @chetmac via his website as he suggested. I’m sure he’ll get to the bottom of it but I don’t have any updates that might help you toward a resolution. I’ll let you know if I work it out.

    @chetmac This is a great plugin. It’s very useful for automating work and allowing end-users to update the website without having access to the back-end nor needing to have any WP knowledge! However, I am having the same problem. I’ve set a virtual posts page. My config is seemingly correct. I can see the plugin do exactly what I need it to do when I visit the link logged in as the site’s admin. However, when I log out or view the same page in Incognito mode, I’m getting a 404 response. Just to confirm, I am using v1.1.60

    • This reply was modified 6 years, 3 months ago by ccostopoulos.

    I’m not sure if this will fix the issues for you guys @pledford @ccostopoulos but there was a virtual post configuration in my setup that was no long able to find a template, or a column within Airtable. After deleting the configuration and re-saving all the ones I’m currently using, the error stopped occurring.

    If you don’t have too many virtual configurations I would attempt to delete them all and recreate them, this might resolve your issue.

    Thank you so much for your reply @moochie ! Unfortunately, that didn’t work. I didn’t have any older configurations. The template I had is very simple and both, the configuration of the virtual post, the airtable view and the html template were just made fresh. The most unusual thing is that everything displays perfectly as expected to the admin, but it renders a 404 to a regular user. πŸ™ While I’m proficient in wordpress and have some years of experience, I’m not a developer. So I passed this onto two of my DEV’s overseas to resolve and they had no luck either. They told me that the way I had set it up was correct and the issue was indeed weird. They didn’t find a workaround. That’s when I came to you guys as a last resort. πŸ™ Any other ideas?

    Plugin Author Chester McLaughlin

    (@chetmac)

    I’d love to take a look if we could do a screenshare or if you can send me a dump of your DB. At this point I’m wondering if there are some hidden/orphaned configs in the DB or if there is some collision with another plugin.

    You can contact me via https://chetmac.com/contact

    @moochie Thanks! That did work for me. I went back and deleted the old configs and rebuilt them and the problem resolved.

    @chetmac I did have two Virtual Field configs that I deleted – but I didn’t check if the problem resolved after deleting just those, unfortunately I went ahead and deleted everything and rebuilt just the active ones. You may have been on the right track there when you asked about this originally.

    The other thing that had me stumped for a while is that I had applied an extra filter to one of the views in Airtable that Airpress was trying to access. I don’t think that was related to or causing the error (I only added the filter afterwards, when I was trying to extract the information directly from Airtable without being able to use Airpress). I thought I’d mention it in case anyone else gets similarly trapped – I’ve now locked the View in Airtable so this can’t happen again πŸ™‚

    @ccostopoulos I’m not sure if that is the same problem I was having – I was getting 404s on all my pages Airpress or not, logged in or not. I hope you find the solution though.

    @chetmac @ccostopoulos @pledford I don’t know if I found this in the docs or just came across it accidentally but the β€œgreediest” expression I have needs to be the last config.

    Like β€œ^(.*)/?” cannot be in front of β€œ^team/(.*)/?” in the order of configs inside the Airpress Virtual Post section. β€œ^(.*)/?” always has to be at the end or doesn’t work. Which actually brings me to what would be a nice feature if it could be implemented. Allow us to move around the order of configs even after they are created; because if I have to create a new one I have to delete the last config with β€œ^(.*)/?”, create the new one then recreate the one with the greedy expression last.

    I have some setup inside my functions.php as well but they cause no issues.

    Btw… this is one of the greatest plugins in WordPress atm

    • This reply was modified 6 years, 3 months ago by moochie.

    Thank you @moochie , changed my config and still the same results. Can view the plugin working perfectly while logged in as an admin however, the 404 persists while browsing incognito.

    Agree, one of the best plugins. Two thumbs up… but it would be awesome to get it to work for my end-user. πŸ™

    @ccostopoulos – Might be a stupid question but is your template airpress uses set to private?

    Hi @moochie unfortunately not. I doubted for a second when you mentioned it, but it’s set to public. And checking the debugger, it’s not showing any errors in the data fetching:

    AIRPRESS LOADED

    CYF Media Articles Feed DEFAULT VirtualPost cyf/media-articles/^(.*)/?

    Cached Query MediaArticles?filterByFormula= needs refreshing in 46

    Cached Query MediaArticles?filterByFormula=OR(…one of 10 ids…) needs refreshing in 46

    asking for Title: 0 of 1

    asking for Image|url: 0 of 1

    asking for Story: 0 of 1

    asking for Title: 0 of 1

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

The topic ‘Getting 404 Errors? Update to version 1.1.60’ is closed to new replies.