Skip Navigation

[Resolved] Address will not appear in custom post type Teachers as a field

This thread is resolved. Here is a description of the problem and solution.

Problem:

Can not created custom address field.

Solution:

This is a server problem, see details here:

https://toolset.com/forums/topic/address-will-not-appear-in-custom-post-type-teachers-as-a-field/#post-1293705

Relevant Documentation:

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by matthewT-9 4 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1293193
Annotation 2019-07-16 212807.png

I am trying to:
add an address to my custom post type called Teachers

I expected to see:
Teacher section added as a field.

Instead, I got:
The other fields I've tried appear to work, and pop up as I click them. Address does not.

I am doing this because I was told you cannot do parametric searches that utilize a User custom field for addresses, and that I needed to create Teacher post type in order to search for Teachers by address later on in a view.

Also:
Is there a way to create a form for registration so that Teachers will not need to register as a User and then again submit information to create their Teacher Post-type profile( which has their address for search by students)? As of now, it seems I should make the user register, and then present them with a profile screen when they login that they can view/edit/submit and then my searches would use that

Thank you very much.

#1293239

Hello,

Q1) The other fields I've tried appear to work, and pop up as I click them. Address does not.

This problem is abnormal, please check these in your website:
1) Make sure you have followed our document to setup the Google map API keys:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

Q2) Is there a way to create a form for registration so that Teachers will not need to register as a User and then again submit information to create their Teacher Post-type profile( which has their address for search by students)?

There isn't such a built-in feature within Toolset forms, one form can handle one post/user, but if you are familiar with PHP codes, you can try these:
1) Create a user form for creating Teacher users
2) After user submit the form, use action hook cred_save_data to trigger a PHP function:
https://toolset.com/documentation/user-guides/front-end-forms/
- Get the new user's ID, and create a new profile post for the new user, for example:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($user_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==123) //Change the ID of your form for creating Teacher users
    {
		$my_post = array(
		  'post_title'    => 'test teacher',
		  'post_status'   => 'publish',
		  'post_author'   => $user_id,
		);
		 
		// Insert the post into the database
		wp_insert_post( $my_post ); //More details about wp_insert_post() here: https://developer.wordpress.org/reference/functions/wp_insert_post/
    }
}
#1293249

Q1) The other fields I've tried appear to work, and pop up as I click them. Address does not.

This problem is abnormal, please check these in your website:
1) Make sure you have followed our document to setup the Google map API keys:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/
I did this already.
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again
I did this already, both theme and plugins, and saw no change.

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/
I did this already, nothing is added to the log when trying to create the map field. Also the log only has warnings for an invalid cron argument, so nothing looks bad there either.

Q2) Is there a way to create a form for registration so that Teachers will not need to register as a User and then again submit information to create their Teacher Post-type profile( which has their address for search by students)?
Thank you for your explanation! I'll wait until I am working on this part to ask any questions I may have then.

#1293253

Did you see any JS errors when you click "Address" field button?

You can also provide a test site with the same problem, fill below private message box with login details and FTP access, I need to test and debug it in a live website, thanks

#1293541

I have tried the credentials you provided above, it is not valid, I get this error:
ERROR: Incorrect username or password.

Please check it, make sure it is valid, thanks

#1293593

Thanks for the details, I can log into your website, but I don't see the similar problem with my Chrome browser, see it here:
hidden link

I can create the custom address field without any problem, it might be a browser problem please try these:
1) Clear your browser cache and test again
2) Try with another browser, and test again

#1293629
Annotation 2019-07-17 063758.png

It's not working for me in with cache cleared for firefox, chrome, or internet explorer.

I'm not sure what the issue is. Even if I go to previously created fields, I can't add back in the test address you created.

Would you be able to recreate that address field for me again? It's at least a workaround, as I don't believe I'll need another one, other than possibly on the user profiles at most.

Thank you Luo for all your help and let me know if you have any ideas on what could cause the issue only on my end but not yours.

#1293655

As your request, I have recreate that address field in your website.

It might be a computer/IP address problem, can you ask your friend in other place to test it again?

#1293705

My issue is resolved now. Thank you!

I tried using a different internet connection like you suggested. STILL did not work.

Then I wondered, maybe it's Kaspersky Security Cloud (Kaspersky's antivirus/security software). I disabled protection, and it now works!

Maybe keep it in mind for future customers when something similar happens. I really didn't think security software was that "invasive" but I guess this one is.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.