Skip Navigation

[Resolved] edit a custom post type where id equals xx

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

Problem:

Check if current user custom field has the same ID stored as the currently viewed post.

Solution:

Well what you can do is to use our conditional shortcode to do this.


[wpv-conditional if="( '[wpv-post-id]' eq '[types usermeta="company-id"][/types]' )"] 
 
Edit Link 
 
[/wpv-conditional]
This support ticket is created 5 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 – 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 4 replies, has 2 voices.

Last updated by michaelV-16 5 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1205660

Tell us what you are trying to do?
I have an custom field connected to a post type 'company'. I made a cred form to edit the company. But The cred form shows the first company. I want the cred form to show the company where the custom field 'company_id' from the user is equal to the company_id(post id) of the company.

#1205756

Shane
Supporter

Languages: English (English )

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

Hi Michael,

Thank you for contacting our support forum.

How is this form navigated to? Is it done by clicking an Edit Company link on the company page itself ?

Please let me know.

Thanks,
Shane

#1206025

It is navigated to via a link on a welcome screen. It should work like this query: "select from company where user_id = 'user_id'" The user id comes from the logged in user.

#1206349

Shane
Supporter

Languages: English (English )

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

Hi Michael,

Well what you can do is to use our conditional shortcode to do this.


[wpv-conditional if="( '[wpv-post-id]' eq '[types usermeta="company-id"][/types]' )"] 

Edit Link 

[/wpv-conditional]

Please try this and let me know if this helps.
Thanks,
Shane

#1206388

My issue is resolved now. Thank you!