: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @param WP_Post $post Current post object.
function page_attributes_meta_box( $post ) {
if ( is_post_type_hierarchical( $post->post_type ) ) :
'post_type' => $post->post_type,
'exclude_tree' => $post->ID,
'selected' => $post->post_parent,
'show_option_none' => __( '(no parent)' ),
'sort_column' => 'menu_order, post_title',
* Filters the arguments used to generate a Pages drop-down element.
* @see wp_dropdown_pages()
* @param array $dropdown_args Array of arguments used to generate the pages drop-down.
* @param WP_Post $post The current post.
$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
$pages = wp_dropdown_pages( $dropdown_args );
if ( ! empty( $pages ) ) :
<p class="post-attributes-label-wrapper parent-id-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
endif; // End empty pages check.
endif; // End hierarchical check.
if ( count( get_page_templates( $post ) ) > 0 && (int) get_option( 'page_for_posts' ) !== $post->ID ) :
$template = ! empty( $post->page_template ) ? $post->page_template : false;
<p class="post-attributes-label-wrapper page-template-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label>
* Fires immediately after the label inside the 'Template' section
* of the 'Page Attributes' meta box.
* @param string|false $template The template used for the current post.
* @param WP_Post $post The current post.
do_action( 'page_attributes_meta_box_template', $template, $post );
<select name="page_template" id="page_template">
* Filters the title of the default page template displayed in the drop-down.
* @param string $label The display value for the default page template title.
* @param string $context Where the option label is displayed. Possible values
* include 'meta-box' or 'quick-edit'.
$default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'meta-box' );
<option value="default"><?php echo esc_html( $default_title ); ?></option>
<?php page_template_dropdown( $template, $post->post_type ); ?>
<?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?>
<p class="post-attributes-label-wrapper menu-order-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p>
<input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" />
* Fires before the help hint text in the 'Page Attributes' meta box.
* @param WP_Post $post The current post.
do_action( 'page_attributes_misc_attributes', $post );
<?php if ( 'page' === $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
<p class="post-attributes-help-text"><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
// Link-related Meta Boxes.
* Displays link create form fields.
* @param object $link Current link object.
function link_submit_meta_box( $link ) {
<div class="submitbox" id="submitlink">
<div id="minor-publishing">
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?>
<div style="display:none;">
<?php submit_button( __( 'Save' ), '', 'save', false ); ?>
<div id="minor-publishing-actions">
<div id="preview-action">
<?php if ( ! empty( $link->link_id ) ) { ?>
<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e( 'Visit Link' ); ?></a>
<div class="clear"></div>
<div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-private">
<label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked( $link->link_visible, 'N' ); ?> /> <?php _e( 'Keep this link private' ); ?></label>
<div id="major-publishing-actions">
/** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'post_submitbox_start', null );
if ( ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] && current_user_can( 'manage_links' ) ) {
'<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
/* translators: %s: Link name. */
esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ),
<div id="publishing-action">
<?php if ( ! empty( $link->link_id ) ) { ?>
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" />
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ); ?>" />
<div class="clear"></div>
* Fires at the end of the Publish box in the Link editing screen.
do_action( 'submitlink_box' );
<div class="clear"></div>
* Displays link categories form fields.
* @param object $link Current link object.
function link_categories_meta_box( $link ) {
<div id="taxonomy-linkcategory" class="categorydiv">
<ul id="category-tabs" class="category-tabs">
<li class="tabs"><a href="#categories-all"><?php _e( 'All categories' ); ?></a></li>
<li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li>
<div id="categories-all" class="tabs-panel">
<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
if ( isset( $link->link_id ) ) {
wp_link_category_checklist( $link->link_id );
wp_link_category_checklist();
<div id="categories-pop" class="tabs-panel" style="display: none;">
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
<?php wp_popular_terms_checklist( 'link_category' ); ?>
<div id="category-adder" class="wp-hidden-children">
<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
<p id="link-category-add" class="wp-hidden-child">
<label class="screen-reader-text" for="newcat">
/* translators: Hidden accessibility text. */
_e( '+ Add New Category' );
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
* Displays form fields for changing link target.
* @param object $link Current link object.
function link_target_meta_box( $link ) {
<fieldset><legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. */
<p><label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_blank</code> — new window or tab.' ); ?></label></p>
<p><label for="link_target_top" class="selectit">
<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( '_top' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_top</code> — current window or tab, with no frames.' ); ?></label></p>
<p><label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( '' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_none</code> — same window or tab.' ); ?></label></p>
<p><?php _e( 'Choose the target frame for your link.' ); ?></p>
* Displays 'checked' checkboxes attribute for XFN microformat options.
* @global object $link Current link object.
* @param string $xfn_relationship XFN relationship category. Possible values are:
* 'friendship', 'physical', 'professional',
* 'geographical', 'family', 'romantic', 'identity'.
* @param string $xfn_value Optional. The XFN value to mark as checked
* if it matches the current link's relationship.
* @param mixed $deprecated Deprecated. Not used.
function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
$link_rels = preg_split( '/\s+/', $link_rel );
// Mark the specified value as checked if it matches the current link's relationship.
if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) {
echo ' checked="checked"';
if ( '' === $xfn_value ) {
// Mark the 'none' value as checked if the current link does not match the specified relationship.
if ( 'family' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) )
echo ' checked="checked"';
if ( 'friendship' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) )
echo ' checked="checked"';
if ( 'geographical' === $xfn_relationship
&& ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) )
echo ' checked="checked"';
// Mark the 'me' value as checked if it matches the current link's relationship.
if ( 'identity' === $xfn_relationship
&& in_array( 'me', $link_rels, true )
echo ' checked="checked"';
* Displays XFN form fields.
* @param object $link Current link object.
function link_xfn_meta_box( $link ) {
<table class="links-table">
<th scope="row"><label for="link_rel"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th>
<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
<?php _e( 'another web address of mine' ); ?></label>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'contact' ); ?>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?>
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friend' ); ?>
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> /> <?php /* translators: xfn (friendship relation): http://gmpg.org/xfn/ */ _ex( 'none', 'Type of relation' ); ?>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'met' ); ?>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-worker' ); ?>
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'colleague' ); ?>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-resident' ); ?>
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'neighbor' ); ?>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> /> <?php /* translators: xfn (geographical relation): http://gmpg.org/xfn/ */ _ex( 'none', 'Type of relation' ); ?>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'child' ); ?>
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'kin' ); ?>
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'parent' ); ?>
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sibling' ); ?>
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'spouse' ); ?>
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> /> <?php /* translators: xfn (family relation): http://gmpg.org/xfn/ */ _ex( 'none', 'Type of relation' ); ?>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
<legend class="screen-reader-text"><span>
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'muse' ); ?>
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'crush' ); ?>
<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'date' ); ?>
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?>
<p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="https://gmpg.org/xfn/">XFN</a>.' ); ?></p>
* Displays advanced link options form fields.
* @param object $link Current link object.
function link_advanced_meta_box( $link ) {
<table class="links-table" cellpadding="0">
<th scope="row"><label for="link_image"><?php _e( 'Image Address' ); ?></label></th>
<td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr( $link->link_image ) : '' ); ?>" /></td>
<th scope="row"><label for="rss_uri"><?php _e( 'RSS Address' ); ?></label></th>
<td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr( $link->link_rss ) : '' ); ?>" /></td>
<th scope="row"><label for="link_notes"><?php _e( 'Notes' ); ?></label></th>
<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : '' ); // textarea_escaped ?></textarea></td>
<th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th>
<td><select name="link_rating" id="link_rating" size="1">
for ( $rating = 0; $rating <= 10; $rating++ ) {
echo '<option value="' . $rating . '"';
if ( isset( $link->link_rating ) && $link->link_rating === $rating ) {
echo ' selected="selected"';