Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: block-template-utils.php
$template_hierarchy[] = $type;
[1500] Fix | Delete
break;
[1501] Fix | Delete
}
[1502] Fix | Delete
}
[1503] Fix | Delete
}
[1504] Fix | Delete
// Handle `archive` template.
[1505] Fix | Delete
if (
[1506] Fix | Delete
str_starts_with( $slug, 'author' ) ||
[1507] Fix | Delete
str_starts_with( $slug, 'taxonomy' ) ||
[1508] Fix | Delete
str_starts_with( $slug, 'category' ) ||
[1509] Fix | Delete
str_starts_with( $slug, 'tag' ) ||
[1510] Fix | Delete
'date' === $slug
[1511] Fix | Delete
) {
[1512] Fix | Delete
$template_hierarchy[] = 'archive';
[1513] Fix | Delete
}
[1514] Fix | Delete
// Handle `single` template.
[1515] Fix | Delete
if ( 'attachment' === $slug ) {
[1516] Fix | Delete
$template_hierarchy[] = 'single';
[1517] Fix | Delete
}
[1518] Fix | Delete
// Handle `singular` template.
[1519] Fix | Delete
if (
[1520] Fix | Delete
str_starts_with( $slug, 'single' ) ||
[1521] Fix | Delete
str_starts_with( $slug, 'page' ) ||
[1522] Fix | Delete
'attachment' === $slug
[1523] Fix | Delete
) {
[1524] Fix | Delete
$template_hierarchy[] = 'singular';
[1525] Fix | Delete
}
[1526] Fix | Delete
$template_hierarchy[] = 'index';
[1527] Fix | Delete
[1528] Fix | Delete
$template_type = '';
[1529] Fix | Delete
if ( ! empty( $template_prefix ) ) {
[1530] Fix | Delete
list( $template_type ) = explode( '-', $template_prefix );
[1531] Fix | Delete
} else {
[1532] Fix | Delete
list( $template_type ) = explode( '-', $slug );
[1533] Fix | Delete
}
[1534] Fix | Delete
$valid_template_types = array( '404', 'archive', 'attachment', 'author', 'category', 'date', 'embed', 'frontpage', 'home', 'index', 'page', 'paged', 'privacypolicy', 'search', 'single', 'singular', 'tag', 'taxonomy' );
[1535] Fix | Delete
if ( in_array( $template_type, $valid_template_types, true ) ) {
[1536] Fix | Delete
/** This filter is documented in wp-includes/template.php */
[1537] Fix | Delete
return apply_filters( "{$template_type}_template_hierarchy", $template_hierarchy );
[1538] Fix | Delete
}
[1539] Fix | Delete
return $template_hierarchy;
[1540] Fix | Delete
}
[1541] Fix | Delete
[1542] Fix | Delete
/**
[1543] Fix | Delete
* Inject ignoredHookedBlocks metadata attributes into a template or template part.
[1544] Fix | Delete
*
[1545] Fix | Delete
* Given an object that represents a `wp_template` or `wp_template_part` post object
[1546] Fix | Delete
* prepared for inserting or updating the database, locate all blocks that have
[1547] Fix | Delete
* hooked blocks, and inject a `metadata.ignoredHookedBlocks` attribute into the anchor
[1548] Fix | Delete
* blocks to reflect the latter.
[1549] Fix | Delete
*
[1550] Fix | Delete
* @since 6.5.0
[1551] Fix | Delete
* @access private
[1552] Fix | Delete
*
[1553] Fix | Delete
* @param stdClass $changes An object representing a template or template part
[1554] Fix | Delete
* prepared for inserting or updating the database.
[1555] Fix | Delete
* @param WP_REST_Request $deprecated Deprecated. Not used.
[1556] Fix | Delete
* @return stdClass|WP_Error The updated object representing a template or template part.
[1557] Fix | Delete
*/
[1558] Fix | Delete
function inject_ignored_hooked_blocks_metadata_attributes( $changes, $deprecated = null ) {
[1559] Fix | Delete
if ( null !== $deprecated ) {
[1560] Fix | Delete
_deprecated_argument( __FUNCTION__, '6.5.3' );
[1561] Fix | Delete
}
[1562] Fix | Delete
[1563] Fix | Delete
if ( ! isset( $changes->post_content ) ) {
[1564] Fix | Delete
return $changes;
[1565] Fix | Delete
}
[1566] Fix | Delete
[1567] Fix | Delete
$hooked_blocks = get_hooked_blocks();
[1568] Fix | Delete
if ( empty( $hooked_blocks ) && ! has_filter( 'hooked_block_types' ) ) {
[1569] Fix | Delete
return $changes;
[1570] Fix | Delete
}
[1571] Fix | Delete
[1572] Fix | Delete
$meta = isset( $changes->meta_input ) ? $changes->meta_input : array();
[1573] Fix | Delete
$terms = isset( $changes->tax_input ) ? $changes->tax_input : array();
[1574] Fix | Delete
[1575] Fix | Delete
if ( empty( $changes->ID ) ) {
[1576] Fix | Delete
// There's no post object for this template in the database for this template yet.
[1577] Fix | Delete
$post = $changes;
[1578] Fix | Delete
} else {
[1579] Fix | Delete
// Find the existing post object.
[1580] Fix | Delete
$post = get_post( $changes->ID );
[1581] Fix | Delete
[1582] Fix | Delete
// If the post is a revision, use the parent post's post_name and post_type.
[1583] Fix | Delete
$post_id = wp_is_post_revision( $post );
[1584] Fix | Delete
if ( $post_id ) {
[1585] Fix | Delete
$parent_post = get_post( $post_id );
[1586] Fix | Delete
$post->post_name = $parent_post->post_name;
[1587] Fix | Delete
$post->post_type = $parent_post->post_type;
[1588] Fix | Delete
}
[1589] Fix | Delete
[1590] Fix | Delete
// Apply the changes to the existing post object.
[1591] Fix | Delete
$post = (object) array_merge( (array) $post, (array) $changes );
[1592] Fix | Delete
[1593] Fix | Delete
$type_terms = get_the_terms( $changes->ID, 'wp_theme' );
[1594] Fix | Delete
$terms['wp_theme'] = ! is_wp_error( $type_terms ) && ! empty( $type_terms ) ? $type_terms[0]->name : null;
[1595] Fix | Delete
}
[1596] Fix | Delete
[1597] Fix | Delete
// Required for the WP_Block_Template. Update the post object with the current time.
[1598] Fix | Delete
$post->post_modified = current_time( 'mysql' );
[1599] Fix | Delete
[1600] Fix | Delete
// If the post_author is empty, set it to the current user.
[1601] Fix | Delete
if ( empty( $post->post_author ) ) {
[1602] Fix | Delete
$post->post_author = get_current_user_id();
[1603] Fix | Delete
}
[1604] Fix | Delete
[1605] Fix | Delete
if ( 'wp_template_part' === $post->post_type && ! isset( $terms['wp_template_part_area'] ) ) {
[1606] Fix | Delete
$area_terms = get_the_terms( $changes->ID, 'wp_template_part_area' );
[1607] Fix | Delete
$terms['wp_template_part_area'] = ! is_wp_error( $area_terms ) && ! empty( $area_terms ) ? $area_terms[0]->name : null;
[1608] Fix | Delete
}
[1609] Fix | Delete
[1610] Fix | Delete
$template = _build_block_template_object_from_post_object( new WP_Post( $post ), $terms, $meta );
[1611] Fix | Delete
[1612] Fix | Delete
if ( is_wp_error( $template ) ) {
[1613] Fix | Delete
return $template;
[1614] Fix | Delete
}
[1615] Fix | Delete
[1616] Fix | Delete
$changes->post_content = apply_block_hooks_to_content( $changes->post_content, $template, 'set_ignored_hooked_blocks_metadata' );
[1617] Fix | Delete
[1618] Fix | Delete
return $changes;
[1619] Fix | Delete
}
[1620] Fix | Delete
[1621] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function