{CODICTS} Snippets is now available

MyListing Copy Related Listing Data

The {CODICTS} MyListing Copy Related Listing Data plugin automatically prefills listing form fields with data from a related listing. When a user selects a related listing on the Add or Edit Listing form, matching fields are instantly populated with the related listing’s data — saving users from re-entering information that already exists elsewhere.

Installation & Activation

Start by downloading the plugin from the Downloads page on your dashboard on the CoDicts website.

After downloading, install and activate the plugin in WordPress by navigating to “Plugins” > “Add New” > “Upload Plugin” and selecting the downloaded zip file. Click “Install Now” and then “Activate”.

Once activated, navigate to “Copy RLD” in the WordPress admin sidebar to enable and configure the feature for your listing types.


Key Features

FeatureDescription
Automatic Field PrefillWhen a user selects a related listing, matching fields are automatically populated with the related listing’s data.
Per-Listing-Type ConfigurationEnable the feature independently for each MyListing listing type.
Field-Level ControlSelect exactly which fields should be copied from the related listing.
Hidden Field SupportOptionally hide copied fields so they are populated silently in the background.
Comprehensive Field Type SupportHandles text, textarea, editor, select, multiselect, checkbox, radio, date, recurring date, work hours, related listings, term selects, file uploads, repeaters, links, and location fields.
Loading AnimationDisplays a spinner overlay on affected fields while data is being fetched.

Use Case Example

Imagine a directory where users create “Branch” listings that belong to a “Company” listing. When a user creates a new Branch and selects the parent Company from a related-listing field, the plugin can automatically copy the Company’s address, phone number, email, description, logo, and other shared data into the Branch form — eliminating redundant data entry.

This works any time two listing types share common fields and are connected through a related-listing relationship.


How It Works

1. You configure which listing types use the feature, which related-listing field triggers the copy, and which fields should be copied.

2. When a user opens the Add Listing or Edit Listing form, the plugin watches the configured related-listing dropdown.

3. When the user selects a related listing, a loading spinner appears on the target fields while data is fetched.

4. The related listing’s data is copied into the matching fields on the current form. The user can still edit any visible field before submitting.

5. If the user changes their related listing selection, the fields are re-populated with the new listing’s data.

Important: The fields you want to copy must have matching field keys between the source (related) listing type and the target listing type. For example, if the Company listing type has a field with key phone_number, the Branch listing type must also have a field with key phone_number for the copy to work.


Configuring the Plugin

Navigate to “Copy RLD” in the WordPress admin sidebar. The settings page displays all registered MyListing listing types, each with its own configuration panel.

Step 1: Enable a Listing Type

Check the “Enabled?” checkbox next to the listing type you want to configure. The configuration panel expands to reveal the field selection options.

Step 2: Select the Related Listing Field

From the dropdown, choose which related-listing field should trigger the data copy. Only fields with a relation type of “Belongs to one” or “Has one” appear in this dropdown — these relation types guarantee a single related listing is selected.

This field becomes the trigger: when the user changes its value on the frontend form, the copy action fires.

Note: If the listing type has no related-listing fields with “Belongs to one” or “Has one” relation types, a message “No current related listing field” is displayed and the feature cannot be used for that listing type.

Step 3: Select Fields to Copy

Below the related field dropdown, all fields on the listing type are listed with checkboxes. Check the fields whose values you want to copy from the related listing.

The trigger field itself is automatically disabled in the checklist (marked as “current field”) since copying it back into itself would be circular.

The following field types are excluded from the list as they are decorative UI elements with no data:

Excluded TypeReason
form-headingDecorative section heading — no data to copy
form-wizardForm step wizard — no data to copy

Step 4: Optionally Hide Copied Fields

Each field row has a secondary “Hide?” checkbox. When checked, the field is hidden from the user on the frontend form but still receives the copied data in the background.

This is useful when you want to silently inherit data from the related listing without the user seeing or needing to edit it.

Note: The “Hide?” checkbox is only interactable when the parent field checkbox is checked. If a field is unchecked (not being copied), its “Hide?” control is disabled.

Step 5: Save

Click “Save Changes”. The configuration is now active.


Frontend User Experience

On the Add/Edit Listing Form

When a user visits the Add Listing or Edit Listing form for a configured listing type:

1. Any fields marked as hidden are immediately hidden from view.

2. The related-listing dropdown works normally — the user searches and selects a related listing.

3. Upon selection, a loading spinner appears over each target field while data is being fetched.

4. Once data arrives, the fields are populated and the spinners disappear.

5. The user can still manually edit any visible copied field before submitting.

6. If the user changes their related listing selection, the fields are re-populated with the new listing’s data.


Supported Field Types

The plugin handles all common MyListing field types:

Field TypeCopy Behavior
Text, Number, Email, URL, PasswordValue is copied directly into the input field.
TextareaValue is copied directly.
Text Editor (TinyMCE)Content is set via the TinyMCE editor API.
SelectThe matching option is selected.
MultiselectAll matching options are selected.
CheckboxMatching checkboxes are checked.
RadioThe matching radio button is selected.
DateDate is set via the date range picker.
Recurring DateExisting dates are cleared, new entries are created with all sub-fields populated (datepicker, checkbox, number, radio).
Work HoursExisting entries are cleared, day statuses are set, time slots are created with from/to values, and timezone is set.
Term SelectOptions are cleared and replaced with the related listing’s terms.
Related ListingOptions are cleared and replaced with the related listing’s references (IDs and titles).
Select Product(s)Options are cleared and replaced with the related listing’s product references.
File / Image UploadExisting uploads are cleared and replaced with previews referencing the original file URLs (files are not re-uploaded).
General RepeaterExisting items are deleted, new items are created, and all sub-fields (including accordion photos) are populated.
LinksSame repeater behavior as General Repeater.
LocationSame repeater behavior with a brief delay for map initialization.

Understanding Field Key Matching

The plugin copies data based on field keys, not field labels. Both the source and target listing types must have fields with identical keys for the copy to work.

Example that works:

Company Listing TypeBranch Listing TypeResult
Field key: phone_numberField key: phone_numberData is copied
Field key: emailField key: emailData is copied

Example that doesn’t work:

Company Listing TypeBranch Listing TypeResult
Field key: company_phoneField key: phone_numberNo data copied — keys don’t match

When setting up listing types that will use this plugin, plan your field keys to be consistent across related listing types.


How File and Image Fields Work

When file or image fields are copied, the plugin does not re-upload the files. Instead, it references the original file URLs from the source listing. This means:

The copied listing and the source listing share the same physical files in the media library.

If the source listing’s files are deleted from the media library, the copied references will break.

This approach is efficient (no duplicate files) but means the files are linked rather than independently duplicated.


Frequently Asked Questions

Can I copy data between different listing types?

Yes — that’s the primary use case. The related-listing field connects two listing types (e.g., “Branch” belongs to “Company”), and data is copied from the related listing type to the current one. The key requirement is that both listing types have fields with matching field keys.

Does the copy overwrite existing field values?

Yes. When a related listing is selected, all configured fields are overwritten with the related listing’s data. If the user has already entered data in those fields, it will be replaced.

Can the user edit the copied data before submitting?

Yes. Visible (non-hidden) copied fields are fully editable. The data is simply pre-filled — the user can modify any values before submitting the form.

Does this work on the Edit Listing form?

Yes. The plugin works on both the Add Listing and Edit Listing forms.

Can I use multiple related-listing fields as triggers?

No. The plugin supports one trigger field per listing type. You select one related-listing field (with “Belongs to one” or “Has one” relation type) as the trigger.

Are file fields re-uploaded when copied?

No. File fields reference the original file URLs from the source listing. The files are shared, not duplicated.

What field types are not supported?

The form-heading and form-wizard field types are excluded as they are decorative/navigational UI elements with no data to copy.

What if the source and target field keys don’t match?

No data will be copied for that field. The plugin matches fields by their field_key — the key must be identical on both listing types.

What happens if I change the related listing selection?

Any in-progress data fetch is cancelled, and a new request is fired for the newly selected listing. All configured fields are re-populated with the new listing’s data.


Troubleshooting

Fields Not Being Copied

CauseSolution
Field keys don’t matchThe most common issue. The field key on the source listing type must match exactly with the field key on the target listing type. Check both listing types in the MyListing Type Editor.
Listing type not enabledVerify the listing type’s “Enabled?” checkbox is checked in the Copy RLD settings.
Wrong related field selectedEnsure the correct related-listing field is selected in the dropdown. It must be a field with “Belongs to one” or “Has one” relation type.
Field not checked in settingsConfirm the target field’s checkbox is checked in the field list on the settings page.

Loading Spinner Stays Indefinitely

CauseSolution
JavaScript errorOpen the browser console (F12 → Console) to check for errors or failed requests.
Nonce expiredIf the user has been on the page for a long time, the security token may have expired. Refresh the page to regenerate it.
Related listing deletedIf the selected related listing has been deleted or is inaccessible, the data request may fail. Verify the listing still exists and is published.

“No Current Related Listing Field” Message

This means the listing type has no related-listing fields with “Belongs to one” or “Has one” relation types. The plugin requires one of these relation types because they guarantee a single related listing is selected (as opposed to “Has many” which allows multiple). Add a related-listing field with the correct relation type in the MyListing Type Editor.

Hidden Fields Not Working

CauseSolution
Parent checkbox not checkedThe “Hide?” checkbox only takes effect if the field’s copy checkbox is also checked.
JavaScript disabledFields are hidden via JavaScript. If the user has JavaScript disabled, hidden fields will be visible. (The form itself requires JavaScript to function.)

File/Image Fields Not Copying

CauseSolution
Files not accessibleCopied files reference the original URLs. Ensure the source listing’s files are publicly accessible and haven’t been deleted from the media library.

“MyListing Theme Not Detected” Error

The MyListing theme must be installed and active. Go to Appearance → Themes to verify. If using a child theme, ensure it properly extends MyListing.

Settings Page Not Appearing

CauseSolution
MyListing not activeInstall and activate the MyListing theme first.
Insufficient permissionsOnly users with the manage_options capability (typically Administrators) can access the settings page.
Plugin not activatedVerify the plugin is active in Plugins → Installed Plugins.

For further support, visit codicts.com or contact us at support@codicts.com.

CoDicts Co., Ltd. © 2021-2026. All rights reserved