We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
This field: http://d.pr/i/so9ffk Something like:
/** * Get post title from URL if title is empty. * * @param array $link_values The link field array. */ function get_link_field_title( $link_values ) { if ( empty( $link_values['title'] ) && false !== strpos( $link_values['url'], home_url() ) ) { $linked_post = url_to_postid( $link_values['url'] ); $link_title = 0 === $linked_post ? '' : get_the_title( $linked_post ); } elseif ( empty( $link_values['title'] ) ) { $link_title = $link_values['url']; } else { $link_title = $link_values['title']; } return $link_title; }
Maybe it should be a helper function in core?
The text was updated successfully, but these errors were encountered:
We should cache url_to_postid. See how WPCOM does it here https://github.com/Automattic/vip-go-mu-plugins/blob/52549ae9a392fc1343b7ac9dba4ebcdca46e7d55/vip-helpers/vip-caching.php#L252
url_to_postid
Sorry, something went wrong.
trinef
No branches or pull requests
This field: http://d.pr/i/so9ffk
Something like:
Maybe it should be a helper function in core?
The text was updated successfully, but these errors were encountered: