Get parent post id and meta field is not working in cred_save_data
Started by: Luit
in: Toolset Professional Support
Quick solution available
Problem: I have a Form that is used to create child post in a one-to-many post relationship. I would like to get the value of a custom field from the related parent post in a cred_save_data callback, but it does not seem to be working.
Solution: The relationship is not yet set in a cred_save_data hook, so you can either use the cred_submit_complete hook instead, or access the parent post ID directly from the parent select field in the $_POST superglobal.
$parent_post_id = $_POST['@relationshipslug_parent'];
$parent_field_value = get_post_meta( $parent_post_id, 'wpcf-fieldslug', true);
2
8
4 years, 4 months ago
Christian Cox
Post reference field repeated
Started by: jackC-7
in: Toolset Professional Support
2
6
4 years, 4 months ago
Minesh
Exclude pages in view results
Started by: juan-carlosO-2
in: Soporte profesional de Toolset
2
5
4 years, 4 months ago
juan-carlosO-2
updating database
Started by: corineV
in: Toolset Professional Support
3
27
4 years, 4 months ago
corineV
Intermediary post fields not saving WYSIWYG content
Started by: joshM-4
in: Toolset Professional Support
2
8
4 years, 4 months ago
Christian Cox
Database upgrade Toolset – Problem migrating associations
Started by: SJ5362
in: Toolset Professional Support
2
10
4 years, 4 months ago
Jamal
Display related posts and headline only if there are any
Started by: haraldO
in: Toolset Professional Support
Quick solution available
2
5
4 years, 4 months ago
haraldO
Define related posts on import via XML/CSV
Started by: anthonyB-6
in: Toolset Professional Support
Quick solution available
2
3
4 years, 4 months ago
anthonyB-6
second custom code crashes the site
Started by: avansisI-2
in: Toolset Professional Support
2
5
4 years, 4 months ago
avansisI-2
Update parent post author when creating or editing child post
Started by: jamesR-13
in: Toolset Professional Support
Quick solution available
2
16
4 years, 5 months ago
jamesR-13
associations can't find parent post
Started by: davidm-13
in: Toolset Professional Support
3
24
4 years, 5 months ago
Kelly
Need some help to display relations
Started by: riinA
in: Toolset Professional Support
2
7
4 years, 5 months ago
riinA
Change modified date when relationship change
Started by: avansisI-2
in: Toolset Professional Support
2
2
4 years, 5 months ago
Nigel
relationship fields – many to many
Started by: heinrichT
in: Toolset Professional Support
2
2
4 years, 5 months ago
Minesh
View: custom field filter doesn’t keep post relationship filter when filtering
Started by: Zayne
in: Toolset Professional Support
Quick solution available
Problem:
The user is filtering a view using a relationship field and a URL param. After filtering using AJAX, the view loses the filter because the URL parameter is not preserved.
Solution:
To fix this, we need to add a hidden field that will keep the value of the URL param. This needs custom code such as:
add_filter( 'wpv_filter_end_filter_form', 'prefix_add_hidden_field_edition_id', 99, 3 );
function prefix_add_hidden_field_edition_id( $out, $view_settings, $view_id ) {
$views = array( 9286 );
if ( in_array( $view_id, $views) ) {
$edition_id = isset($_GET['edition_id']) ? $_GET['edition_id'] : '';
$out = '<input type="hidden" id="edition_id" name="edition_id" value="' . $edition_id . '" class="js-wpv-filter-trigger form-control" />' . $out;
}
return $out;
}
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_end_filter_form
3
9
4 years, 5 months ago
Zayne