Skip Navigation

[Resolved] How insert meta data in a custom post from frontend

This support ticket is created 2 years, 10 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 17 replies, has 2 voices.

Last updated by fabioF-5 2 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#2262817

Hello
I'm trying to insert a meta data of a custom post from customers frontend.
In a backend I use yoast to complete metadata of custom, but I'd like to know if you have some way to integrate yoast automatically from frontend.
I'd like to integrate a field in the same custom form that automatically insert meta data.
Thank you for any help about this task
Regards

#2262893

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

Thank you for getting in touch.

You should be able to do this by following the instructions in the link below.
https://toolset.com/course-lesson/letting-toolset-edit-custom-fields-created-by-other-plugins/

This should allow you to be able to add the yoast fields to your form.

Thanks,
Shane

#2263485

Hello
Thank you for help me with this task, I saw the link you shared with me and I found field create for other plugin, but unfortunally I couldn't find field of yoast .
Do you have some idea how and where I can find it ?
Best regards

#2263699

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

I'm able to see the yoast fields on my end.

Would you mind allowing me to have admin access to the website as well as the post type that has the Yoast Fields ?

Thanks,
Shane

#2265833

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

Thank you I checked on the site and it seems that you're not allowing the editing of files through your backend.

However you will perhaps need to try using this code below.

/** * Make all post types available on Forms screen to manage non-Types fields */ 
add_filter( 'option_wpcf-custom-types', 'ts_blank_cpt_option' ); function ts_blank_cpt_option( $option ){

$screen = get_current_screen();

if ( isset( $screen ) && $screen->id == 'toolset_page_CRED_Fields' ) { $option = false; }

return $option; }

This will make all the post types visible on the manage non-Types fields .

If you're able to add this code to your theme's functions.php and then check on the manage non-Types fields screen and see if your CPT shows up and then start searching for the yoast fields.

Please let me know once you've done this.
Thanks,
Shane

#2271595

My issue is resolved now. Thank you!

#2271981

Hi Shane
I tried to add the code to function.php on backend theme but after that the site stop to work and to fix I had to deleted the code I added.
Do you have some Idea?
I use generatepress theme
thank you
many regards

#2272325

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

Given that the code is meant to run only on the backend we will need to add a filter to ensure that happens.

Usually this is done when you add the custom code to Toolset->Settings-> Custom Code and set the run context to Admin Only. However given that you've restricted the permissions of your server I wasn't able to add the code here and set the context.

Try using this code below that should set the context of the code.

add_action('init', 'admin_only');

function admin_only() {

    if( !is_admin() )
        return;

  function ts_blank_cpt_option( $option ){
 
$screen = get_current_screen();
 
if ( isset( $screen ) && $screen->id == 'toolset_page_CRED_Fields' ) 
{ 
	$option = false; 
}
 
return $option;
 }
add_filter( 'option_wpcf-custom-types', 'ts_blank_cpt_option' ); 
}

Thanks,
Shane

#2272545

Hi Again,
I added the code you sent me in toolset - > settings - > Custom code after modify wp-config to have access to edit area.
I saved and then I went in Post Form and manage not toolset field but can't see anything of yoast

Do you have some Idea?
I didn't restrict your access and you want I can share credential of my website to check why it is doing like so.
Is this private area where I can share credential with you?

#2272565

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

Please provide the login credentials once more. They are automatically removed when a thread is marked as resolved.

Thanks,
Shane

#2272579

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

Thank you. I was able to setup the code correctly now.

Can you log in and verify that it all works correctly for you.

Thanks,
Shane

#2272601
2022-01-21_22h19_54.png

Hi
thank you, now there is something more even I don't know which is the field I have to use
here is a screenshoot about not toolset fields I can see now. Which is the one about meta title and meta description? How I have to use with this function?

#2272613

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Fabio,

In order for some of the fields to show up you would've need to populate the fields manually at least once so it can be picked up by our plugin.

I went ahead and did this on one of your post and removed the test data but the fields below should now be available for you to select.
_yoast_wpseo_metadesc
_yoast_wpseo_title

I've confirmed that they are now showing up and you should now be able to add it to your form.

Please let me know if this helps.
Thanks,
Shane

#2272639

Ok many thanks, Finally I found yoast meta description and title, I'm happy now to continue with my project.
Can I ask you about relationship between 2 custom post type?
Regards

#2273785

Hello Shane,
It's working but I'm noticing something that is not working properly on view loop after that modify:

It's stop to working dynamic choose in Heading, Single field, conditional block.
It's not possible to set dynamic choose from custom of current custom type.
It could be possible it's correlate with modify on filter I added to show in admin non toolset field like yoast field?
Could you help me to fix the problem without loose the possibility to see yoast field?
Many thanks
regards