/** * Homeslandia.ro — HARD LOCK: * Preserve manual Title + Description for Houzez properties on any non-manual-edit update (imports/cron/etc). * Keep status published. * * Allows normal editing from "Properties > Edit" (classic editor) without interference. * Does not touch any other fields (so sold/for sale metas can still update). */ add_filter('wp_insert_post_data', 'hl_ro_lock_title_content_status_except_manual_edit', 999, 2); function hl_ro_lock_title_content_status_except_manual_edit($data, $postarr) { // Only for Houzez properties (usually post type 'property') $post_type = $data['post_type'] ?? ($postarr['post_type'] ?? ''); if ($post_type !== 'property') { return $data; } $post_id = isset($postarr['ID']) ? absint($postarr['ID']) : 0; // New property: allow title/content from importer, but keep published if (!$post_id) { if (isset($data['post_status'])) { $data['post_status'] = 'publish'; } return $data; } // ✅ If YOU are editing the property in wp-admin (Properties > Edit) and saving normally, allow changes if (hl_ro_is_manual_property_edit_save($post_id)) { return $data; } // Otherwise (cron/import/manual importer run/REST scripts/etc) -> LOCK title/content and keep publish $existing = get_post($post_id); if (!$existing) { return $data; } $data['post_title'] = (string) $existing->post_title; $data['post_content'] = (string) $existing->post_content; $data['post_status'] = 'publish'; return $data; } /** * Detect a normal manual save from the Property edit screen (classic editor). * This avoids blocking your own edits. */ function hl_ro_is_manual_property_edit_save($post_id) { if (!is_admin()) { return false; } // Classic editor save uses action=editpost if (!isset($_POST['action']) || $_POST['action'] !== 'editpost') { return false; } // Must be saving THIS post $posted_id = isset($_POST['post_ID']) ? absint($_POST['post_ID']) : 0; if ($posted_id !== absint($post_id)) { return false; } // Permission check if (!current_user_can('edit_post', $post_id)) { return false; } return true; } Built-in cabinets Archives - Page 17 of 117 - HomesLandia Consulting

Built-in cabinets

1166 Properties
Sort by:

Compare listings

Compare