How to add Custom Field to Child Site edit screen

Hi! I need to add a “Last Checked” field to the Child Site edit screen for our developers to update once they’ve checked a website. I’ve read this topic: How do I add custom fields to site dashboard? and this topic: Customise Dashboard Menu of Managed Child Site, and have added the “Last Updated” column to the Manage Sites dashboard, but can’t figure out how to add a datepicker input to the Child Site edit screen.

Could I have a hand?


Hi @harryray,

To add new settings fields to the Site Edit page, you can use the mainwp_manage_sites_edit action.
It’s documented here: mainwp_manage_sites_edit

Once you hook it up, you can use the something like this in the HTML part:

<div class="ui grid field">
     <label class="six wide column middle aligned">Last Checked</label>
     <div class="ui six wide column">
          <div class="ui calendar mainwp_datepicker" >
	       <div class="ui input left icon">
			<i class="calendar icon"></i>
			<input type="text" placeholder="Date" autocomplete="off" id="" value=""/>

Let me know how it goes and if any additional help is needed

1 Like

Hey Bogdan. Thanks for your reply! Sorry, I think I’m just still confused on how to actually hook this field up to the database so it can store a value?

Hi @harryray,

Can you please share the custom code you have so far I will review it and update what is missing.

1 Like

He means that the sampled code does not save the field to the database or retrieve it on page load of the site edit screen.

I need to do the same thing. When MainWP created the “clients” feature, the custom fields became client custom fields, so they apply to all websites where the client is used (I think that’s when it happend).

I need to have fields that are only for the individual sites, so the normal Clients->client fields isn’t going to work.

I’ve been trying to figure out how to add custom fields only at the site level, and that allows them to be used in Pro Reports tags as well.

My use case is that each website has a certain maintenance plan level and plan options, and I need to save that info somewhere and be able to show it in the report.

Let me try to provide more details about the whole process.

The mainwp_manage_sites_edit action allows you to hook the HTML part. So you can use it to add a new field in the form.

However, to save the value on the Save Settings submission, you need to hook the code to the mainwp_update_site action.

To get the whole system working as expected,

  1. Hook in the HTML part to the form
  2. Hook in the code to save value

I will get a working example from our dev team and post it here as soon as possible.

1 Like

Here is an example:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.