diyanK
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
| Status | Topic | Supporter | Voices | Posts | Freshness |
|---|---|---|---|---|---|
|
Slider and Gallery blocks not working as expected with dynamic source.
Started by: diyanK in: Toolset Professional Support |
|
1 | 10 | 7 months, 3 weeks ago | |
|
Latest versions break file upload via toolset forms on front-end
Started by: diyanK in: Toolset Professional Support |
|
2 | 2 | 1 year, 11 months ago | |
|
Sorting a classic view table layout using a child post's Date custom field value
Started by: diyanK in: Toolset Professional Support |
|
2 | 3 | 2 years, 7 months ago | |
|
Use my location stopped working
Started by: diyanK in: Toolset Professional Support |
|
2 | 3 | 2 years, 7 months ago | |
|
Update-able web app distibution
Started by: diyanK in: Toolset Professional Support |
|
3 | 7 | 2 years, 8 months ago | |
|
Change relationships per page in wp-admin
Started by: diyanK in: Toolset Professional Support |
|
2 | 4 | 3 years ago | |
|
Add custom field value to View Loop item contener
Started by: diyanK in: Toolset Professional Support |
|
2 | 7 | 3 years, 1 month ago | |
|
Turn off automatic live preview for Toolset in Gutenberg
Started by: diyanK in: Toolset Professional Support |
|
2 | 2 | 3 years, 1 month ago | |
|
Post Date field doesn’t output date format according to Site Language setting.
Started by: diyanK
in: Toolset Professional Support
Problem: Solution: [wpv-post-date format="F j Y"] Relevant Documentation: |
|
2 | 3 | 3 years, 4 months ago | |
|
Record post relationship changes
Started by: diyanK in: Toolset Professional Support |
|
2 | 6 | 3 years, 4 months ago | |
|
CRED checkbox validation fails after WP 5.6 update
Started by: diyanK in: Toolset Professional Support |
|
2 | 5 | 4 years, 9 months ago | |
|
Content template "View with" issue
Started by: diyanK in: Toolset Professional Support |
|
2 | 6 | 4 years, 10 months ago | |
|
Delete related posts and their attachments when deleting parent post with cred-delete-post shortcode
Started by: diyanK
in: Toolset Professional Support
Problem: I would like to use a cred-delete-post shortcode to allow my visitors to delete a post on the front-end of the site. This post may be the parent of one or more child posts. When the parent post is deleted, I would like to delete its attachments, and its child posts as well as their attachments. Solution: Use the 'delete' action in the cred-delete-post shortcode, and customize the following code snippet to work with your post type slugs and post relationship slug.
function delete_post_children($post_id) {
global $wpdb;
$post_type = get_post_type( $post_id );
if ( $post_type == 'products' || $post_type == 'profile') {
$ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_parent = $post_id AND post_type = 'attachment'");
foreach ( $ids as $id ) {
wp_delete_attachment($id, true);
}
if(has_post_thumbnail( $post_id )) {
$tn_id = get_post_thumbnail_id( $post_id );
wp_delete_attachment($tn_id, true);
}
if( $post_type == 'profile' ) {
// in this case, we want to force-delete the child product posts as well
$profile_products = toolset_get_related_posts(
$post_id,
'profile-product',
[
'query_by_role' => 'parent',
'role_to_return' => 'child',
'limit' => 10000,
'orderby' => null,
]
);
foreach($profile_products as $profile_product ) {
wp_delete_post( $profile_product, true );
}
}
}
}
add_action('before_delete_post', 'delete_post_children');
Relevant Documentation: |
|
2 | 12 | 4 years, 11 months ago | |
|
CRED custom taxonomy select option – empty items disappeared
Started by: diyanK in: Toolset Professional Support |
1 | 2 | 4 years, 11 months ago |