impress-org / google-maps-builder

One Google Maps plugin to rule them all. Google Maps Builder is intuitive, sleek, powerful and easy to use. Forget the rest, use the best.
https://wordpress.org/plugins/google-maps-builder/
32 stars 9 forks source link

Single map posts cause 404 errors until permalinks refreshed #240

Closed kevinwhoffman closed 7 years ago

kevinwhoffman commented 7 years ago

Issue Overview

After installation, single map posts result in 404 errors until permalinks are refreshed. This can be resolved by visiting Settings > Permalinks, but it should be done programmatically on activation.

Possible Solution

This function activation_flush_rewrites() is never being called, so the permalinks never get refreshed after the CPT is registered. I believe this broke when core was separated out from the free and pro repos.

https://github.com/WordImpress/maps-builder-core/blob/master/includes/class-gmc-activate.php#L526-L532

Steps to Reproduce

  1. Install WP 4.7.2 and Maps Builder Pro 2.1.1
  2. Create and publish a map.
  3. Click the permalink to view single map post on front-end.
  4. Confirm 404 page not found.
  5. Visit Settings > Permalinks to refresh permalinks.
  6. Revisit the single map post to confirm map now displays.

Related

https://wordpress.org/support/topic/nothing-found-when-trying-to-view-map/

kevinwhoffman commented 7 years ago

@DevinWalker The reason activation_flush_rewrites() is not being called is because the activation hook shown below is being registered too late. I confirmed via Xdebug that the activation hook is definitely being registered, but I think it's registered after that hook has already fired. I could use a second opinion. Thanks.

https://github.com/WordImpress/Google-Maps-Builder/blob/master/google-maps-builder.php#L124-L127

DevinWalker commented 7 years ago

Yeah it is being fired too late, please proceed with fixing.