Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/gianfranco2605/pr-plugin-similiar-properties/archive/refs/heads/main.zipA WordPress plugin that filters similar properties queries to match only by deepest child/grandchild locations, excluding top-level parent terms.
Description
This plugin modifies the similar properties query in RealHomes theme to ensure that properties only match based on their deepest location hierarchy level. For example:
- If a property has "Perrine" (child of Miami), it will only match other "Perrine" properties, not "Miami" properties
- If a property has "Test" (grandchild: Miami → Little Havana → Test), it will match other "Test" properties AND "Little Havana" properties, but not "Miami" properties
- If a property has a great-grandchild term, it will match other great-grandchildren AND their parent grandchildren
Features
- Filters out top-level parent terms from similar properties queries
- Uses the deepest child/grandchild/great-grandchild term available
- Includes the direct parent of deepest terms (if parent is not top-level)
- Comprehensive debug logging (can be disabled)
- Clean, object-oriented code structure
- Follows WordPress coding standards
Installation
- Upload the
pbcr-similar-propertiesfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
Requirements
- WordPress 6.4+
- PHP 8.2+
- RealHomes theme (or compatible theme using
inspiry_similar_properties_filterhook)
How It Works
The plugin hooks into the inspiry_similar_properties_filter filter and:
- Calculates the depth of each term assigned to the property
- Finds the deepest term(s) (child, grandchild, great-grandchild, etc.)
- Includes the deepest term(s) and their direct parents (if parent is not top-level)
- Excludes all top-level parent terms
Debug Mode
Debug logging is disabled by default in production. To enable it for troubleshooting, edit includes/SimilarPropertiesFilter.php and set:
private $debug_mode = true;
Debug logs are written to wp-content/debug.log (requires WP_DEBUG_LOG to be enabled in wp-config.php).
Note: Debug mode should only be enabled temporarily for troubleshooting purposes as it can impact performance.
Changelog
1.0.0
- Initial release
- Filter similar properties by deepest child/grandchild locations
- Exclude top-level parent terms
- Include parent of deepest terms when applicable