Cannot Submit or Update Listing When Region ID Is Missing or Deleted

Hi,

I have encountered another issue related to caching with Litespeed cache.

When users fill out the fields on the submit listing page and click on submit, the form reloads without submitting. On reload, this happens:

  • The title and the description fields “look” empty: they are visually empty but sometimes, reloading manually automatically submits the form with the correct data. Most times you reload manually and nothing happens, they stay empty.
  • After the automatic reload, you fill in the title and description again, click on submit, and get an error message “The Region field contains an invalid value”

After much testing, the issue is with Litespeed cache (again!), and specifically the Object cache. Turning it OFF solves all problems.

I can confirm, for one, that the Region error keeps appearing after each submit try, until the object cache TTL expires (currently 6 minutes), because if I set the Object cache to 1 second, the Region error does not appear (effectively it is like turning Object cache OFF). So it all points to Object cache.

The Litespeed cache settings are as recommended by Hivepress tutorial, except:

  • All CSS and JS optimizations are OFF, due to other issues in my case

Cache logged in users is OFF. Cache REST API is OFF (as per recommendations).

Only when object cache is OFF, all works fine, forms submit, and no error messages are shown. No other settings help. I have been close to 20 hours trying different settings, also according to different A.I. answers. Excluding URIs (including the hivepress submit listing URI and hivepress wp-json URIs), adding DO Not Cache groups, etc, don’t work. Forcing reloads doesn’t work either. I have also deactivated ALL other plugins, except Litespeed and Woocommerce, and the issues remained. I also rolled back Hivepress versions and Litespeed versions, with no luck.

However, adding “transient” to the Do Not Cache groups seems to solve the “Region” error (not the reloading issue). I think it is not a good idea to add transient to this group, although it might point in the good direction for a solution.

I can only think there are conflicts related to:

  • Hivepress API calls and object cache
  • AJAX reload (after category selection) and object cache
  • Transients and object cache
  • A combination of all of the above

The issues don’t happen in the edit listing form.

I hope someone had the same issues and found a solution…

Hi,

Regarding the cache issue, could you please confirm if this is reproducible on our demo site? Our demo has LiteSpeed configured according to our blog post recommendations. The issue you’re describing can happen if you have caching enabled for logged-in users plus REST API caching, both of these can affect this behavior. We recommend disabling both and serving static pages only to guest users. For logged-in users, only JS + CSS optimization and object cache should be enabled.

Regarding the issue with regions, could you please let me know if you’ve recently deleted any regions manually? This could be the cause of the issue.

Hi,

like mentioned before, I also have Hivepress default Litespeed settings, plus that I disabled ALL CSS and JS optimizations because they conflict with other stuff on my site. I am definitely not caching REST API or logged in users. They have never been ON.

I have also deactivated absolutely all other plugins except for Hivepress, Litespeed and Woocommerce, and the same issue reapppears.

It is possible that I have deleted regions in the past, but making sure there were no listings attached to them anymore. What I have done for sure is have Regions off for some time, before you added IDs to regions, and then ON, when you updated Hivepress and Regions with IDs started working better for me.

Your demo site works. it usually works because you don’t have all the funcionalities in it (like geolocation) and others that could affect performance.

To sum it up, the only thing that gets rid of the problem is turning object cache OFF in the Litepeed settings, but it is something too important to turn OFF permanently.

I will try setting Regions OFF on my staging site and see if the issue persists. Could be Regions+Object cache issue

Just tested setting regions OFF.

It seems to work now. Tested 5 times submitting new listings…no errors at all. Turned regions ON, and right away I could not submit my listing.

So, what happens when you have Hivepress (+Bookings+Rentalhive+Marketplace+Mapbox geolocation) and you are using Regions together with Object Cache ON in Litespeed:

  • After pressing submit, form reloads without title and description
  • After re-entering title and description and then trying to submit again, form returns error: “The Region field contains and invalid value”
  • Trying to re-submit or reload has no effect. The region error keeps appearing. It seems to keep appearing until object cache TTL expires (currently 6 minutes)
  • It seems not to matter if the region was already existing before (from previous listings) or if it is a new region

The only thing that helps is as described, either turn Object Cache OFF, or turn Regions OFF. Not really good solutions…

I have a complicated workaround, but I think this might be a bug that needs to be solved

Some more info after more hours testing

Every time I try to submit a listing a the Region error pops up, in the console an error appears like POST>https://www.mydomain.com/wp-json/hivepress/v1/listings/2854/ 400 (Bad Request)

In the WP debug log, a PHP notice appears with every Region error, stating something like PHP Notice: The function as_next_scheduled_action has been called incorrectly. as_next_scheduled_action() was called before the Action Scheduler data store was initialized.

Hope this helps too. By the way, my Mapbox API tokens are set properly (both)

Thanks for the detailed issue report. We have LiteSpeed set up on the theme demos, and ListingHive has Geolocation enabled, but maybe some settings differ. For example, enabling cache for logged-in users may cause the described issue because LiteSpeed tries to serve it as static HTML, but the page has dynamic checks (e.g. the listing status to redirect to the next step). You can try disabling caching for logged-in users or exclude the “/submit-listing” URL and try again. Please also make sure that the hosting-side caching is also disabled during the tests.

Hi,

thanks for the answer, but I have reported in this thread a few times what my Litespeed settings are. I will make it short and repeat all again.

Litespeed settings:

  • Cache logged in users: OFF (has always been OFF, for years)
  • Cache REST API: OFF (has always been OFF, for years, as per recommendations)
  • CSS/JS: all OFF, because it conflicts with some other plugins of mine
  • Object Cache: ON
  • Browser Cache: ON

What I have done (a few things) and tested multiple times, and does NOT work:

  • Deactivating ALL plugins except for Hivepress and Litespeed: no effect
  • Exclude different URIs (one by one and all together, like “/submit-listing”, “wp-json”, “hivepress”…NO effect, does not work
  • Rolling back Litespeed and Hivepress plugins to earlier versions, like from December 2025: does not work
  • Adding groups (like “transient”) to the DO NOT Cache groups: does not work (except for the Regions error that seems not to appear anymore, but needs testing). The reloading of the page still occurs, with the title and description empty
  • Forcing reloads of the submit listing page: does not work
  • Turning Hostinger CDN OFF: does not work

What DOES work:

  • Deactivating Regions, or
  • Deactivating Litespeed Object Cache, or
  • Both

If I keep Regions and/or Object Cache ON, this errors keep appearing:

  • Submit listing form reloads on submit button press, but with the Title and Description fields cleared
  • Error “The Region field contains an invalid value” on submit
  • Console error POST>https://www.mydomain.com/wp-json/hivepress/v1/listings/2854/ 400 (Bad Request)
  • PHP notices: PHP Notice: The function as_next_scheduled_action has been called incorrectly. as_next_scheduled_action() was called before the Action Scheduler data store was initialized.

I use Hivepress+Bookings+Rentalhive+Marketplace+Mapbox geolocation. I need Regions and Object Cache, so I hope there is a solution

Thanks, we’ll look into this further before releasing the next update. If deactivating Regions resolves the issue, it may not be related to cache, I assume it’s related to a recent update for the large drop-down fields loading options via AJAX – please let me know if there are more than 100 regions in Listings/Regions on your site.

Hi

No, there are not more than 100 regions, and there are currently only 10 listings.

I tested some more, and it seems like:

  • If there are 1 or more listings in a region, and you try to submit one in the same region, it works
  • If you try to submit a listing that belongs to a new region (0 listings): it usually fails, reloads the page without title and description, and if you try to submit again, you get the Region error. Deactivating object cache sometimes solves the issue. But with some regions (for example Prospekt Vernadskogo, Moscow, Russia), not even that solves the problem. But when I deactivated the Litespeed plugin completely, it finally worked. Now I am more confused than before, but pretty sure Litespeed interferes

Maybe it is linked to what you said, but after my last tests above, I suspect there might also be issues with the coding of some regions, since it says that there is an invalid value in the Regions field. No idea, this is a mess.

By the way, when I rolled back to a Hivepress version before the one with the “dropdown” update, it still failed. Also, it looks like another user reported something similar Listing submitting is on a loop. It’s not submitting

Thanks for the details.

Please let me know if there were any customizations related to regions or any changes in generating regions (e.g. if you add them manually or deleted any regions manually). By default, there can’t be newly created regions with 0 listings because the region is generated only when the listing location is added/changed, and the region is immediately assigned to the created/updated listing.

HI,

no, there were no customizations related to generating regions.

I might have deleted a few, but very carefully after deleting all listings in that region first. Since I did not have many listings/regions, it was not difficult.

What I did is that I had Regions ON early after releasing the website. Then I turned them OFF because they interacted with my translation plugin. After you updated Hivepress assigning IDs to regions, I turned them ON again (because that was the conflict with my translating plugin, it was creating regions in both languages). Since then, there are no double regions left, or double regions created, which is good.

What I meant with 0 listings was that if a new listing is in a region not yet created before, it seems to fail. It also seems to fail if the region has only 1 listing. I am consistently testing submitting listings with an address contained in a region with 2 or more listings already (at city level), and it does not show any failures in this case.

And as mentioned before, I disabled all other plugins except for the Hivepress ones, Woocommerce, and Litespeed, and the failure persisted.

Thank you for the detailed issue report.

We can take a look at a sample listing where this issue can be reproduced. We can debug this further to identify the exact cause, for example, it might be related to an invalid or non-existent region ID.

ok, how could you debug this?

Update 1: worse news. I was simply updating the description of an existing listing (I did not touch the location) and the Region error appeared! So it can happen on listing submit, and on update

Update 2: I tried to filter the errors to try and ignore this error, but the code does nothing

add_filter(
    'hivepress/v1/forms/listing_submit/errors',
    function( $errors, $form ) {
        // Define the exact error message you want to ignore
        $error_to_ignore = '"Region" field contains an invalid value.';

        // Loop through errors and unset the matching one
        foreach ( $errors as $key => $error ) {
            if ( $error === $error_to_ignore ) {
                unset( $errors[ $key ] );
            }
        }

        return $errors;
    },
    10,
    2
);

I also tried the same snippet with listing_update instead, with no luck. Maybe you have a better snippet, that would be great

This is driving me insane, and like this I will never have a working website. I am amazed that nobody else has this problem, or did not notice it. Like I said many times, I deactivated ALL other plugins and only kept the Hivepress ones, Woocommerce and Litespeed, and it still didn’t work most of the times. I guess nobody else in the world has Litespeed, or Hostinger…

Please note that if the Regions block were generally blocking listing updates, we would have seen many reports of this issue by now. Most likely, this is something specific to your setup, possibly a combination of settings or plugins.

From what we can tell, this error only occurs if a listing has a saved ID for a region that no longer exists. For example, this can happen if a region was deleted manually or removed automatically.

If you’d like to debug this further (or if you’re familiar with the code), you could use the hook hivepress/v1/models/listing/errors instead of the form hook in your example. You can log the errors like this:

error_log(print_r($listing->_get_errors(), true));

This will allow you to see which value is stored in the listing’s _regions field. If you notice an ID there, please check whether that region still exists in the listing_regions table. You could also use a snippet similar to the one you tried to remove the error, though we don’t generally recommend suppressing errors this way.

We understand that troubleshooting and issues themselves can be frustrating, and we want to assure you that we’re here to help. Our goal is always to provide a solution, workaround, or guidance to resolve the problem.

Thank you

yes, that’s why I said that I don’t understand why there are no other reports, because my setup is pretty standard.

The error occurs generally when a listing is being created in a new region, although like I just said, I tried to update the description of an older working and existing listing and it suddenly threw the Region error.

I’ll try the hivepress/v1/models/listing/errors hook, thanks

In the meantime, update 3:

I used this code to record the errors in a custom field of a test listing:

add_filter(
    'hivepress/v1/forms/listing_submit/errors',
    function( $errors, $form ) {
		
        // get test listing
   
        $listing = \HivePress\Models\Listing::query()->get_by_id(288403);
	
        //save errors in custom field
		foreach ( $errors as $key => $error ) {
		   $listing->set_custom_errors($key.$error);
		   $listing->save_custom_errors();
		 }

        return $errors;
    },
    10,
    2
); 

This code correctly displays the errors in the test listing (I checked with other errors on purpose). But the regions error does not show! On the submit page, you get the error message, but in reality it is not recorded/stored as an error.

Please try this one instead, since the error occurs on the listing validation (not form validation) level, a different hook should work in this case:

add_filter(
	'hivepress/v1/models/listing/errors',
	function( $errors, $listing ) {
		if ( $errors ) {
			error_log( print_r( $listing->get_region(), true ) );
		}

		return $errors;
	},
	1000,
	2
);

This code logs the Region field value if there are errors.

You can also check and unset the error if this resolves the issues, by comparing the error text in the same way as in the previously shared snippet.

Hope this helps

Well, done all the error debugging

Like I just discovered before, there are no errors logged because there are no errors saved in the $errors array. No matter which snippet I use (model or form).

I only get the -“Region” field contains an invalid value.- error message upon trying to submit (or sometime just update) a listing, which blocks actual submission or update. It is very weird that just a message blocks this.

If I deactivate Object cache or Litespeed completely then: error message gone immediately and listing submits/updates directly after listing-submit (or update) page refresh

Since count($errors) is 0 in the ‘hivepress/v1/forms/listing_submit/errors’ filter, I can set and save the status of the listing to pending whenever there are 0 errors (because the Region thing is just a message), which works and saves the new listing (pending for moderation), but it then just reloads the submit listing page instead of redirecting to a thank you page. I guess adding a redirection is quite complicated code?

Please try using the hivepress/v1/models/listing/errors filter instead, because this error is triggered when the listing is being saved, not on the forum submission. There’s no Regions field in the submission form, but it’s present on the listing level, so this error message never passes the hivepress/v1/forms/listing_submit/errors filter, but you can catch it (and remove with unset, as a quick but temporary solution) via the hivepress/v1/models/listing/errors filter hook. I tested it locally by manually triggering the Regions error (by removing a region manually after saving it for a listing) and it seems to work.

Hope this helps

I tried to use the hivepress/v1/models/listing/errors filter to log the region error, as described above. It never did log a region error, even when the notice appeared.

Anyways, I added the snippet to unset it now, and I deactivated it on purpose. I wanted to wait until I get the region error after submitting, and then activate the snippet and try to resubmit.

But now for the past few days I am not getting the region error. Litespeed has been updated twice in the past week or so. Maybe the issue solved itself by coincidence (I insist somehow Litespeed was interfering). I hope it stays like this.

If the error comes back, I will apply the error filter snippet and report back.

Thanks for all the help