acf_field_page_link::get_post_result
get_post_result
This function will return an array containing id, text and maybe description data
Method of the class: acf_field_page_link{}
No Hooks.
Returns
(Array).
Usage
$acf_field_page_link = new acf_field_page_link(); $acf_field_page_link->get_post_result( $id, $text );
- $id(required)
- .
- $text(required)
- .
Changelog
| Since 5.4.0 | Introduced. |
acf_field_page_link::get_post_result() acf field page link::get post result code ACF 6.0.4
function get_post_result( $id, $text ) {
// vars
$result = array(
'id' => $id,
'text' => $text,
);
// look for parent
$search = '| ' . __( 'Parent', 'acf' ) . ':';
$pos = strpos( $text, $search );
if ( $pos !== false ) {
$result['description'] = substr( $text, $pos + 2 );
$result['text'] = substr( $text, 0, $pos );
}
// return
return $result;
}