This support ticket is created vor 5 Jahre, 4 Monate. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
You'll only need to remove "&& isset($postarr['wpcf'])" part from line# 7:
For example:
add_filter( 'wp_insert_post_data' , 'modify_post_title' , '99', 2 ); // Grabs the inserted post data so you can modify it.
function modify_post_title( $data, $postarr )
{
if( $data['post_type'] == 'relationship-slug' ) {
// Process title value as needed
$title = 'Title value';
$data['post_title'] = $title ; //Updates the post title to your new title.
}
return $data; // Returns the modified data.
}
You'll replace "relationship-slug" with the actual slug of your post-relationship.
Important note: The above code will automatically update the intermediary post's title, whether it is added directly through its edit screen in the admin area or if it is generated when a relationship is created from the edit screen of the post in the relationship.
1. the custom title doesn't change when i add new entry inside the main CPT that hold the post relationship. for my case its a many -to-many post relationship. i need to click "edit" to go into the main post relationship and click save to get the custom title.
2. also is it possible to identify the slug by many ID's instead of entering the slug., cause the slug name might change later part i am afraid.
> 1. the custom title doesn't change when i add new entry
> inside the main CPT that hold the post relationship. for
> my case its a many -to-many post relationship. i need to
> click "edit" to go into the main post relationship and click
> save to get the custom title.
- In my tests, the functions shared in my last message worked, whether an intermediary post was added/edited through its own edit screen or if a new relationship was created from the participating child or parent post's edit screen.
If you're getting different results, please share a screenshot of exactly how you're editing the post, when the function is not executing.
> 2. also is it possible to identify the slug by many ID's instead
> of entering the slug., cause the slug name might change later
> part i am afraid.
- I assume you referring to the slug value used in the line:
But from performance points of view, this is not a good approach and it is better to manually update the slug value when or if it changes, which can't be too often.
hidden link - 1. title not updated in the cpt that contain the custom relationship. hidden link -2. quick edit unable to update/fetch the fn hidden link 3- only main PR edit post works,
for issue2.
thank you for sharing on the performance view. thats important.
The reason for me to use ID is i have many PR and intermediate PR to add this functions.
do you suggest to create one function for each of the PR ?
i thought of using one single function as the naming method is same for this SET of PR.
For issue 1, I'll need access to your website's admin area, to view how the post-relationship and intermediary posts are set and why the same code is not working.
I've set your next reply as private so that only you and our support team will have access to it.
For issue 2, if you have multiple post-relationships with same custom name requirement, you can use the same function, but updating the conditional line from:
Does your custom code to set the title automatically works, when only custom fields and not the "taxonomy" is used?
Important point to note here is that "$postarr['wpcf']" array will hold only those values which will be available in the form to add/edit the post relationship item in question.
Without the complete picture of what specifically is not working, makes troubleshooting ineffective and totally dependant on the guess work. This results in more time than necessary for the resolution. Did you get a chance to check my message with the test email?
( screenshot: hidden link )
I've received both your emails from yesterday, but unfortunately, the login credentials are not working.
( Message: ERROR: Wrong credentials provided. Please e-mail : hello@your-domain if you need any assistance )
Can you please check the login credentials again and make sure that there are no extra server security layers involved?
In case there are some complex server security policies involved, you can also alternatively make a clone of a development website (with issue reproducible) and share it through a service like Dropbox, Google Drive etc.