You can use get_post_ancestors() (codex) to get an array of all the ancestors id’s, so if I understand you correctly you might want to use
child_of=".end(get_post_ancestors($post->ID))
instead of
child_of=".$post->post_parent
where end() (php doc) gives you the last element of the array.
Related Posts:
- Add section (add_settings_section) to a custom page (add_submenu_page)
- Can i create two tables at single time while installation of custom plugin?
- How can a Firebase user registration and login be integrated into a WordPress site?
- How to override shortcodes.php core file?
- Aggregate Summaries of Posts of Different Blogs in Multisite Instance
- How does WooCommerce display a custom comment_type in Comment Admin?
- WordPress PHP plugin – Settings page error
- How to fork a plugin to avoid updates after modifications?
- How to display public user profile with 2 additional fields? (GitHub source code included)
- echo do_shortcode is not working on theme’s template
- use function inside another function in WP Plugin
- Can you limit the memory usage of a particular plugin?
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- How to remove addthis from my default template
- Average Account Age
- JS Support Ticket – Auto create WP account
- How do I display only the latest post on my home page, while maintaining proper plugin hooks?
- How to remove plug in styles for WPForms Lite [closed]
- Change upload folder for a CPT
- Passing an array from shortcode-function to filter-function
- Plugin update failed – ‘Installation failed: 504 Gateway Time-out 504 Gateway Time-out nginx/1.15.8’ error message
- WP_Async_Task doesn’t appear to be running asynchronously
- Using plugin functions/methods within templates
- How to retain table data in wordpress phpunit tests
- Add custom text color WordPress 3.9 TinyMCE 4 Visual editor
- ACF: post query, hide duplicate values [closed]
- WordPress Jquery UI Spinner
- How to customize a plugin?
- When taxes are country specific they don’t show in the cart totals
- How to replace website?
- changes to header.php not appearing
- List out all the plugins on WordPress instance
- Proper way to use plugin functions in functions.php
- Can WordPress Drop-ins be given their own directory?
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- How can I add IP address to my post?
- Remove Pagination for Product Category Pages WooCommerce
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- Adding a simple Javascript file with a plugin
- How to add/change (woocommerce) product tab icon
- Get post content from outside the loop with plugin shortcode usability
- Adding option values as an array using a multi selectable select box
- How to set the default value as the saved value once a form of widget is saved?
- Custom post type change excerpt more and excerpt length
- Example for use tinymce in wordpress 3.5.1?
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- Advanced custom fields and Slideshow gallery desn’t work together? [closed]
- How can I show registration form inside modal?
- Replace video url with video player
- How could I fix the lowercase problem in nextgen gallery? [closed]
- Need to edit author permissions | custom taxonomy
- Custom Logo Link WordPress
- Where do I put the code snippets I found here or somewhere else on the web?
- WP Import All Multiple Dynamic Link Imports
- admin_notices show after load completed
- Error in Fetching Custom Post Type parent Category URL (slug)
- is there a way to display product gallery images via cdn
- Changing the Default New User Notification Email
- WP Fastest Cache -> Render Blocking Js -> Exclude Js Sources
- function post to trash problem
- How to call function in WordPress on button click?
- How can I see $post object in frontend from functions.php?
- WordPress site hamburger menu toggle not working
- save short-code in my custom plugin settings problem missed something
- WordPress website working fine on localhost but not displaying front pages on webhost
- Change WordPress plugin widget `id_base` without breaking widget
- Uploading website to live causing problems to plug-in and layout
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- save multi-select input using update_option for plugin
- Capture Recaptcha fail event on Contact Form 7
- register_activation_hook not creating table
- How can I share my wordpress site with a friend?
- Making sure updates didn’t break anything
- wp_schedule_event function reference
- Meta box or shortcode help
- Users Ultra: Hide asterisk for required registration fields?
- Retrive images from the_content()
- How to retrieve hashtaged tweets from a list of users and post to WordPress
- Shortcodes can only be used in Pages, not Posts
- how do you point ‘screen_function’ to a function in the same class? [closed]
- Plugin with custom domain
- Create New Admin Menu Section – Like how custom post type works, in a way
- Combining JS files to one script
- How to clean up unnecessary file inside wp-content/plugins/wordpress-seo?
- woocommerce retriving category name as div class?
- Duplicating wordpress install issue
- Woocommerce add product variations block to my custom template
- Ajax button “Load more” is not loading correct language version posts for logged out users
- WordPress REST API Visual Composer Shortcodes
- Unable to pass arguments from plugin form to filter hook using ajax, the data is transferring via ajax but unable to pass as arguments in filter hooks
- How to update changes to multiple sites at the same time
- Why am I getting an error when requiring a file in my plugin?
- restore backup full content or just specific folders
- WooCommerce REST API aborts connection [closed]
- Redirect OLD/Path to NEWURL/Path
- How can I use the zip of my plugin in another website?
- Executing ACF field as a shortcode
- Create custom Header and Footer for a page that uses diffrent theme then the rest of the website
- Elementor Form : client side javascript validation