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:
- Use Notepad++ as HEX-Editor
- How to transfer a WordPress blog to a different domain?
- Change Page’s Tag Using functions.php File
- Help making my pagination plugin better
- Having Multiple authors for the same WordPress Plugin
- WP get_permalink Return Wrong URL
- Pass A Value From Outside To A Plugin Variable
- Remove toolbar option (and set to default to no) in user profile
- [Plugin: Posts 2 Posts] reciprocal connections
- Add query string to plugin URL
- How to add a privacy-checkbox in comment-template?
- Can plugin variables cause conflict?
- Events plugin for theater (event = performance of a production)
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- What are the benefit in adding hook in the init() hook?
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- How to hide plugin from WordPress Multisite admin plugin list
- Unable to install theme recommended plugins on Multisite
- WordPress URL redirect
- Getting selected (highlighted) html from the Visual Editor on Edit Post page?
- Accidentally Broke Site (Please Help) [closed]
- How to redirect to edit.php page after saving the post,product and showing the message “post saved “
- Apple push notification doesn’t work
- How to query the custom fields by language?
- WordPress Ajax Posting from App
- Is any gallery plugin available to generate galleries from existing uploaded images? [closed]
- How Do I Figure Out What File(s) to Edit from Looking at the Source Code [closed]
- Any recommendation on how to manage ads?
- List taxonomy terms for post as checkboxes
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Conditional attributes and logic per product category
- Why Is This Code Causing The Admin Bar to Disappear?
- WordPress stripping away backslashes from HTML
- How create Group Blogs based on user created Groups
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Echo user id of users in seperate table
- How to upload multiple files/images when developing a wordpress plugin?
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- Best practice for including plugin output in a template without using shortcode?
- Recommend a flexible lightbox that allows an image or HTML to be used
- How to apply next/previous classes to LIs for pagination links?
- Socialite WP plugin, unable to obtain API keys from FB
- WordPress reliability
- Include a php file from another plugin
- How to create wordpress widget that is fixed position on the home page
- Php page with filters for custom fields
- How can I fetch data from another website to my wordpress website with mysql database
- How to translate WP Blog (search, category etc.)?
- How can I concatenate variables to search results title? [closed]
- Switch from wp-cron to a server cron job
- Sending customer an email with link to stripe to make payment
- how to change wp-admin url using function file
- How to pass a query string to another page on the same site?
- How can I add a fixed vertical menu to my site? [closed]
- WordPress plugin: efficient way to store large data
- Allow multiple selection of user roles
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Language translation on a fresh english installation
- Sage wordpress add customize register
- Seperate plugin and theme files
- How to make PDF books readable on site with woo-commerce?
- How to implement color picker from WordPress in my boilerplate plugin?
- custom post type plugin error [closed]
- get_post_meta shortcode returns empty field
- How to get a specific string from a url
- Does anybody know how to insert a complete jquery plugin into a wordpress elementor-page?
- How to change WordPress core language using Loco Translate?
- Removing Plugin Action via Theme for Non-admins
- I would like to add a function that allows the customer to add multiples of the same product to their basket, how can I do this easily?
- How to disable/enable PHP plugin functionality based on a TinyMCE toggle-button
- How to give .html extension to just one post not all post
- Override filter variable not working
- Can I Embed a Contact Form within a Contact Form Using Contact Form 7 in WordPress
- Using Widget Logic to place menu on multiple pages?
- Creating wordpress admin page panel [Theme Option]
- ‘Easy Template Path Hints’ for WordPress?
- datetime jquery UI not showing after theme update
- Yoast Seo Plugin meta title not showoing [closed]
- Translating wordpress plugin
- Ajax return 0 in plugin – ajax only used in wp-admin
- URL RewriteRule doesn’t work when using WP Database Participants in my WordPress website
- Upload an image in wordpress plugin
- Plugin – including external javascript calling google maps
- Plugin Hooks Not Shown in WP Cron Jobs
- Some of my php is rendered only when logged as admin
- Contents are missing but shown when switching to another theme in wordpress
- product_tag to style an image
- Being notified when some YouTube video in some post becomes unavailable
- How use Dynamic hyperlink on each wordpress post?
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- _e in wordpress +
- How do I activate my child theme, as I do not see it in developer tools
- How to execute init or woocommerce_init only for checkout page
- how to restore wordpress backup(.rar) manually?
- wordpress jquery is not defined because the head tag is empty
- Questions about using Disqus or Jetpack for comments [closed]
- Any plugin/theme available which suits my requirement? [closed]
- Problems with file_exists() with metabox plugin in WordPress
- How to rewrite URL using .htaccess in WordPress Plugin
- admin_enqueue_scripts using hook_suffix vs GET page