wp mlsimport reindex rebuilds the standalone search index from the properties already on your site. It reads no MLS data, imports nothing and changes no post content, so it is safe to run at any time.
Reach for it when the property pages work but search returns nothing, which is the signature of an index that is out of step with the posts.
Before you start
- Standalone mode is active. The index is the standalone search table, and there is nothing to rebuild without it.
- WP-CLI is available on the server. The command is registered only when WP-CLI is running, so it does not appear in wp-admin.
- You are running the command from the WordPress root directory, or telling WP-CLI where the installation is.
Run it
wp mlsimport reindex
Expected result: a success line naming the number of listings rebuilt, in the form Reindexed 1240 standalone listings.
What it actually does
For every property post on the site it reconstructs the RESO field values from what is stored locally, then rewrites that property’s row in the search index.
- Field values come from the property’s own post meta.
- Values that live only as taxonomy terms are read back from the term, which covers city, state, property type, listing type and status.
- The row is rebuilt with the same builder the import uses, so a reindexed row and an imported row are identical.
- The search text used for keyword matching is regenerated at the same time.
Two kinds of property produce no row. One with no MLS identifier is skipped, because there is nothing to key a row on. One that is not published has its row dropped, so a reindex also clears rows left behind by properties that were trashed or reverted to draft.
The number in the success line counts rows written, not properties scanned. A count lower than your property total is normal and tells you something useful: the difference is properties added by hand with no MLS identifier, plus anything not currently published.
When to run it
- After enabling standalone mode on a site that already has imported properties. The index is built during import, so properties that predate standalone mode have no rows until you build them.
- After a plugin update that changes how a field is mapped. The rebuild brings existing rows onto the new mapping without a re import.
- When search results and the property pages disagree. Properties that open fine but never appear in results are an index problem, not a query problem.
- After a bulk edit of properties in the database. Direct database changes do not run the plugin’s save path, so the index does not hear about them.
Before reaching for a reindex, check whether one property is missing or all of them are. One missing property is usually that listing itself, such as a hand made post with no MLS identifier. Every property missing points at the index, and that is what this command fixes.
Hooks it fires
mlsimport_reindex_propertyaction( int $post_id ), after each property’s row is rebuilt.mlsimport_after_reindexaction( int $count ), once at the end, with the number written.
If it does not work
- The command is not found. The plugin is inactive, or WP-CLI is running against a different WordPress installation. Check with
wp plugin list. - It reports zero. No published property carries an MLS identifier. On a site that has imported successfully, that points at the properties rather than the index.
- It runs out of memory on a large site. Give the command more memory with
php -d memory_limit=1Gin front of your WP-CLI call. - Search is still empty afterwards. The index is not the problem. Check that the search block or shortcode is on a page that standalone mode is serving.
Frequently asked questions
Does it contact the MLS?
No. It reads only what is already stored on your site, so it costs nothing against your MLS and works with the subscription inactive.
Is it safe to run on a live site?
Yes. It rewrites index rows in place and never touches post content, meta or taxonomies.
Can I run it on a schedule?
You can, through your server’s cron, and most sites do not need to. The index is maintained during import, so a scheduled rebuild is treating a symptom.
Is there a way to do this without WP-CLI?
Not from wp-admin. If your host does not offer WP-CLI, open a ticket and we will look at the site with you.
Related
- Standalone hooks reference
- Standalone mode: run MLSImport on any theme
- The Search Results block
- Properties, agents and the eleven taxonomies
Send us the number the command printed and your property count if the two do not explain each other.