It is concatenated because that”s how we combine strings together in PHP, and string is passed because arguments can be passed as a query string or an array of key => value
pairs.
See the get_pages()
documentation for more details.
// So both of these will work:
// 1. Pass string of arguments.
$pages = get_pages( 'child_of=" . $post->ID );
// 2. Pass array of arguments.
$pages = get_pages( array(
"child_of' => $post->ID,
) );
So if I had to give you a reason why would I use the former (the first one in the above example), then it’d be: because it actually works and simpler in the case of the argument in question.
And one could also use double quotes instead, e.g. "child_of={$post->ID}"
, but if you need explanation on that, you should ask on Stack Overflow 🙂
Related Posts:
- Creating WordPress Plugin solely for Admin panel with dash menu and submenus
- Creating a nav menu
- Redirect to another page using contact form 7? [closed]
- WordPress Custom Menu Admin helper plugin
- 2 wordpress site same database
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Check if add_menu_page exists or not
- Redesigning Custom Post Type “Add New” page
- Add custom menu item type
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- How to call “page specific menu items” in template [closed]
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Getting Custom Post Type content from main-site of a Multisite
- Custom database or Custom Post Types?
- Custom comment type maybe?
- Prevent page slug from interfering with custom post type archive permalink?
- Twillio How To Send SMS for Custom Post Type
- Seriously stuck with some custom meta box/plugin stuff
- Themes VS Plugins [duplicate]
- Enable comments for post with comments meta box removed
- How to Build a Movie Library in WordPress 3.x
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- Plugin allowing for artists, events and venues
- Disable Other Plugins on my Custom Post Type?
- How to get images from EDD post?
- Multiple navigation menus to a location?
- custom taxonomy and custom post type url conflict
- Making menu link open in new tab?
- RW Meta Box ,Problem setting post title
- Using default WP menu functionality to link to custom post-type listing?
- get_post_type on post.php
- Easiest way to add dropdown to a page
- Keep a post copy when this one is updated – issue
- how to add a button next to the wordpress view button?
- Merging Two menus in the backend into one menu
- How to retrieve parent menu item name of current submenu item
- Is there a way to establish parent/child relationship in WP menu links exclusively?
- Installing plugins and using complex folder structure with child theme in WordPress
- Adding CSS to custom post type admin page causes error
- ACF: post query, hide duplicate values [closed]
- How to highlight 1st level menu item based on actual page
- WordPress custom taxonomy not showing
- Amazon.com intergration with WordPress?
- Sticky option for custom post types without using custom fields or plugins
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- How can I add a fixed vertical menu to my site? [closed]
- How can I store data from custom fields to custom tables?
- Custom post type change excerpt more and excerpt length
- Use jQuery Datepicker code from plugin
- Order posts of a custom post type by the event date using FT Calendar Plugin
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- Dropdown menu on click change
- Creating teams of users in WordPress
- How do i specify a url to which to redirect the user after he logs out from facebook?
- hardcoded wp pages/plugins problems
- How display specific category post to specific users?
- I cannot include a file in my plugin settings page
- Need to edit author permissions | custom taxonomy
- Import Recent Posts Only and Ignore old ones if exist
- Is it possible to pin a post in second position from top
- WordPress REST API: Query media files attached to a custom post type
- Save log for imports in WordPress database – options-table, custom post type or other place?
- How to get the custom field value using SQL query
- How to display emails as a post?
- Error in Fetching Custom Post Type parent Category URL (slug)
- How to display the category name in the tab and post inside the tab in WordPress?
- Want to build parent-child relationships between custom post types created with CPT UI
- Hidden permalink different from displayed permalink
- Add an action based on custom post meta field
- Ultimate Members Default Post Layout problem
- how to convert frontpage.php to dynamic page?
- WordPress site hamburger menu toggle not working
- Creating custom “player-objects”
- Scroll to ID broken in main menu
- Submenu Page under Settings in Admin Panel
- Sub Categories in drop down menu
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- WordPress menu and plugin installation problem
- Hide some portion on single.php base on author
- Displaying image from a repeatable group
- add_media_page function not creating submenu
- CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
- How can I pass value to function in add_menu_page?
- get recent 12 days post then random in wordpress
- Multiple Plugins Interacting with Menu
- What method should I use for a sidebar widget that reads latest posts?
- Making a Custom Post Type Publish Loop
- WordPress User Frontend Editing Custom Fields
- Is a custom post type considred a plugin?
- Make a magic tag work with Custom Post Types
- How to laod wp_enqueue_style to another header i created my self
- Plugin: Custom menu item problem
- My wp_update_nav_menu action is firing twice
- How to check if the Menubar contains no items?
- jet engine listing for every single taxonomy in post type [closed]
- How to export post tags from wordpress
- Set the title of a custom post automatically by using info from custom fields?
- public custom posts not showing in my wordpress plugin
- plugin translation *.mo file not getting loaded for custom post