/
home
/
altere25
/
quintelacrosse.com
/
wp-includes
/
/home/altere25/quintelacrosse.com/wp-includes
mkdir
upload
Name
Size
Mode
Actions
assets/
-
0755
rm
block-bindings/
-
0755
rm
block-patterns/
-
0755
rm
block-supports/
-
0755
rm
blocks/
-
0755
rm
certificates/
-
0755
rm
css/
-
0755
rm
customize/
-
0755
rm
fonts/
-
0755
rm
html-api/
-
0755
rm
ID3/
-
0755
rm
images/
-
0755
rm
interactivity-api/
-
0755
rm
IXR/
-
0755
rm
js/
-
0755
rm
l10n/
-
0755
rm
php-compat/
-
0755
rm
PHPMailer/
-
0755
rm
pomo/
-
0755
rm
Requests/
-
0755
rm
rest-api/
-
0755
rm
SimplePie/
-
0755
rm
sitemaps/
-
0755
rm
sodium_compat/
-
0755
rm
style-engine/
-
0755
rm
Text/
-
0755
rm
theme-compat/
-
0755
rm
widgets/
-
0755
rm
.htaccess
178
0644
edit
dl
rm
admin-bar.php
37100
0644
edit
dl
rm
atomlib.php
12078
0644
edit
dl
rm
author-template.php
18951
0644
edit
dl
rm
block-bindings.php
5594
0644
edit
dl
rm
block-editor.php
28340
0644
edit
dl
rm
block-i18n.json
316
0644
edit
dl
rm
block-patterns.php
13119
0644
edit
dl
rm
block-template-utils.php
60145
0644
edit
dl
rm
block-template.php
14142
0644
edit
dl
rm
blocks.php
104889
0644
edit
dl
rm
bookmark-template.php
12948
0644
edit
dl
rm
bookmark.php
15427
0644
edit
dl
rm
cache-compat.php
5969
0644
edit
dl
rm
cache.php
13474
0644
edit
dl
rm
canonical.php
34506
0644
edit
dl
rm
capabilities.php
42718
0644
edit
dl
rm
category-template.php
57003
0644
edit
dl
rm
category.php
12709
0644
edit
dl
rm
class-avif-info.php
29615
0644
edit
dl
rm
class-feed.php
539
0644
edit
dl
rm
class-http.php
367
0644
edit
dl
rm
class-IXR.php
2543
0644
edit
dl
rm
class-json.php
43684
0644
edit
dl
rm
class-oembed.php
401
0644
edit
dl
rm
class-phpass.php
6771
0644
edit
dl
rm
class-phpmailer.php
664
0644
edit
dl
rm
class-pop3.php
21174
0644
edit
dl
rm
class-requests.php
2237
0644
edit
dl
rm
class-simplepie.php
453
0644
edit
dl
rm
class-smtp.php
457
0644
edit
dl
rm
class-snoopy.php
37715
0644
edit
dl
rm
class-walker-category-dropdown.php
2469
0644
edit
dl
rm
class-walker-category.php
8477
0644
edit
dl
rm
class-walker-comment.php
14221
0644
edit
dl
rm
class-walker-nav-menu.php
11784
0644
edit
dl
rm
class-walker-page-dropdown.php
2710
0644
edit
dl
rm
class-walker-page.php
7612
0644
edit
dl
rm
class-wp-admin-bar.php
17874
0644
edit
dl
rm
class-wp-ajax-response.php
5266
0644
edit
dl
rm
class-wp-application-passwords.php
15617
0644
edit
dl
rm
class-wp-block-bindings-registry.php
8463
0644
edit
dl
rm
class-wp-block-bindings-source.php
2992
0644
edit
dl
rm
class-wp-block-editor-context.php
1350
0644
edit
dl
rm
class-wp-block-list.php
4757
0644
edit
dl
rm
class-wp-block-metadata-registry.php
10227
0644
edit
dl
rm
class-wp-block-parser-block.php
2555
0644
edit
dl
rm
class-wp-block-parser-frame.php
2017
0644
edit
dl
rm
class-wp-block-parser.php
11532
0644
edit
dl
rm
class-wp-block-pattern-categories-registry.php
5371
0644
edit
dl
rm
class-wp-block-patterns-registry.php
11185
0644
edit
dl
rm
class-wp-block-styles-registry.php
6262
0644
edit
dl
rm
class-wp-block-supports.php
5612
0644
edit
dl
rm
class-wp-block-template.php
2033
0644
edit
dl
rm
class-wp-block-templates-registry.php
7231
0644
edit
dl
rm
class-wp-block-type-registry.php
5013
0644
edit
dl
rm
class-wp-block-type.php
17265
0644
edit
dl
rm
class-wp-block.php
20438
0644
edit
dl
rm
class-wp-classic-to-block-menu-converter.php
4088
0644
edit
dl
rm
class-wp-comment-query.php
48395
0644
edit
dl
rm
class-wp-comment.php
9372
0644
edit
dl
rm
class-wp-customize-control.php
25730
0644
edit
dl
rm
class-wp-customize-manager.php
202539
0644
edit
dl
rm
class-wp-customize-nav-menus.php
57433
0644
edit
dl
rm
class-wp-customize-panel.php
10637
0644
edit
dl
rm
class-wp-customize-section.php
11209
0644
edit
dl
rm
class-wp-customize-setting.php
29889
0644
edit
dl
rm
class-wp-customize-widgets.php
72157
0644
edit
dl
rm
class-wp-date-query.php
35726
0644
edit
dl
rm
class-wp-dependencies.php
15139
0644
edit
dl
rm
class-wp-dependency.php
2627
0644
edit
dl
rm
class-wp-duotone.php
40783
0644
edit
dl
rm
class-wp-editor.php
72335
0644
edit
dl
rm
class-wp-embed.php
15994
0644
edit
dl
rm
class-wp-error.php
7502
0644
edit
dl
rm
class-wp-exception.php
253
0644
edit
dl
rm
class-wp-fatal-error-handler.php
8150
0644
edit
dl
rm
class-wp-feed-cache-transient.php
3176
0644
edit
dl
rm
class-wp-feed-cache.php
969
0644
edit
dl
rm
class-wp-hook.php
16000
0644
edit
dl
rm
class-wp-http-cookie.php
7389
0644
edit
dl
rm
class-wp-http-curl.php
12541
0644
edit
dl
rm
class-wp-http-encoding.php
6689
0644
edit
dl
rm
class-wp-http-ixr-client.php
3506
0644
edit
dl
rm
class-wp-http-proxy.php
5980
0644
edit
dl
rm
class-wp-http-requests-hooks.php
2022
0644
edit
dl
rm
class-wp-http-requests-response.php
4400
0644
edit
dl
rm
class-wp-http-response.php
2977
0644
edit
dl
rm
class-wp-http-streams.php
16859
0644
edit
dl
rm
class-wp-http.php
41506
0644
edit
dl
rm
class-wp-image-editor-gd.php
19886
0644
edit
dl
rm
class-wp-image-editor-imagick.php
39106
0644
edit
dl
rm
class-wp-image-editor.php
16938
0644
edit
dl
rm
class-wp-list-util.php
7443
0644
edit
dl
rm
class-wp-locale-switcher.php
6630
0644
edit
dl
rm
class-wp-locale.php
16111
0644
edit
dl
rm
class-wp-matchesmapregex.php
1828
0644
edit
dl
rm
class-wp-meta-query.php
30531
0644
edit
dl
rm
class-wp-metadata-lazyloader.php
6833
0644
edit
dl
rm
class-wp-navigation-fallback.php
9211
0644
edit
dl
rm
class-wp-network-query.php
19857
0644
edit
dl
rm
class-wp-network.php
12296
0644
edit
dl
rm
class-wp-object-cache.php
17524
0644
edit
dl
rm
class-wp-oembed-controller.php
6905
0644
edit
dl
rm
class-wp-oembed.php
31475
0644
edit
dl
rm
class-wp-paused-extensions-storage.php
5111
0644
edit
dl
rm
class-wp-plugin-dependencies.php
25319
0644
edit
dl
rm
class-wp-post-type.php
30340
0644
edit
dl
rm
class-wp-post.php
6484
0644
edit
dl
rm
class-wp-query.php
154081
0644
edit
dl
rm
class-wp-recovery-mode-cookie-service.php
6877
0644
edit
dl
rm
class-wp-recovery-mode-email-service.php
11183
0644
edit
dl
rm
class-wp-recovery-mode-key-service.php
4608
0644
edit
dl
rm
class-wp-recovery-mode-link-service.php
3463
0644
edit
dl
rm
class-wp-recovery-mode.php
11435
0644
edit
dl
rm
class-wp-rewrite.php
63688
0644
edit
dl
rm
class-wp-role.php
2523
0644
edit
dl
rm
class-wp-roles.php
8586
0644
edit
dl
rm
class-wp-script-modules.php
19366
0644
edit
dl
rm
class-wp-scripts.php
28344
0644
edit
dl
rm
class-wp-session-tokens.php
7451
0644
edit
dl
rm
class-wp-simplepie-file.php
3408
0644
edit
dl
rm
class-wp-simplepie-sanitize-kses.php
1837
0644
edit
dl
rm
class-wp-site-query.php
31625
0644
edit
dl
rm
class-wp-site.php
7454
0644
edit
dl
rm
class-wp-styles.php
11010
0644
edit
dl
rm
class-wp-tax-query.php
19555
0644
edit
dl
rm
class-wp-taxonomy.php
18567
0644
edit
dl
rm
class-wp-term-query.php
40869
0644
edit
dl
rm
class-wp-term.php
5298
0644
edit
dl
rm
class-wp-text-diff-renderer-inline.php
979
0644
edit
dl
rm
class-wp-text-diff-renderer-table.php
18807
0644
edit
dl
rm
class-wp-textdomain-registry.php
10481
0644
edit
dl
rm
class-wp-theme-json-data.php
1809
0644
edit
dl
rm
class-wp-theme-json-resolver.php
35805
0644
edit
dl
rm
class-wp-theme-json-schema.php
7367
0644
edit
dl
rm
class-wp-theme-json.php
160780
0644
edit
dl
rm
class-wp-theme.php
65413
0644
edit
dl
rm
class-wp-token-map.php
28618
0644
edit
dl
rm
class-wp-user-meta-session-tokens.php
2990
0644
edit
dl
rm
class-wp-user-query.php
43654
0644
edit
dl
rm
class-wp-user-request.php
2222
0644
edit
dl
rm
class-wp-user.php
22827
0644
edit
dl
rm
class-wp-walker.php
13322
0644
edit
dl
rm
class-wp-widget-factory.php
3347
0644
edit
dl
rm
class-wp-widget.php
18424
0644
edit
dl
rm
class-wp-xmlrpc-server.php
214948
0644
edit
dl
rm
class-wp.php
26119
0644
edit
dl
rm
class-wpdb.php
118389
0644
edit
dl
rm
class.wp-dependencies.php
373
0644
edit
dl
rm
class.wp-scripts.php
343
0644
edit
dl
rm
class.wp-styles.php
338
0644
edit
dl
rm
comment-template.php
102773
0644
edit
dl
rm
comment.php
130275
0644
edit
dl
rm
compat.php
16974
0644
edit
dl
rm
cron.php
41594
0644
edit
dl
rm
date.php
400
0644
edit
dl
rm
default-constants.php
11365
0644
edit
dl
rm
default-filters.php
35685
0644
edit
dl
rm
default-widgets.php
2222
0644
edit
dl
rm
deprecated.php
190130
0644
edit
dl
rm
embed-template.php
338
0644
edit
dl
rm
embed.php
37908
0644
edit
dl
rm
error-protection.php
4121
0644
edit
dl
rm
feed-atom-comments.php
5504
0644
edit
dl
rm
feed-atom.php
3048
0644
edit
dl
rm
feed-rdf.php
2668
0644
edit
dl
rm
feed-rss.php
1189
0644
edit
dl
rm
feed-rss2-comments.php
4136
0644
edit
dl
rm
feed-rss2.php
3799
0644
edit
dl
rm
feed.php
23411
0644
edit
dl
rm
fonts.php
9751
0644
edit
dl
rm
formatting.php
335229
0644
edit
dl
rm
functions.php
283163
0644
edit
dl
rm
functions.wp-scripts.php
14558
0644
edit
dl
rm
functions.wp-styles.php
8583
0644
edit
dl
rm
general-template.php
169492
0644
edit
dl
rm
global-styles-and-settings.php
21205
0644
edit
dl
rm
http.php
27084
0644
edit
dl
rm
https-detection.php
5661
0644
edit
dl
rm
https-migration.php
4741
0644
edit
dl
rm
kses.php
74575
0644
edit
dl
rm
l10n.php
68415
0644
edit
dl
rm
link-template.php
157710
0644
edit
dl
rm
load.php
55658
0644
edit
dl
rm
locale.php
162
0644
edit
dl
rm
media-template.php
63043
0644
edit
dl
rm
media.php
218485
0644
edit
dl
rm
meta.php
64409
0644
edit
dl
rm
ms-blogs.php
25772
0644
edit
dl
rm
ms-default-constants.php
4921
0644
edit
dl
rm
ms-default-filters.php
6636
0644
edit
dl
rm
ms-deprecated.php
21759
0644
edit
dl
rm
ms-files.php
2711
0644
edit
dl
rm
ms-functions.php
91249
0644
edit
dl
rm
ms-load.php
19883
0644
edit
dl
rm
ms-network.php
3782
0644
edit
dl
rm
ms-settings.php
4124
0644
edit
dl
rm
ms-site.php
40490
0644
edit
dl
rm
nav-menu-template.php
25917
0644
edit
dl
rm
nav-menu.php
44347
0644
edit
dl
rm
option.php
101759
0644
edit
dl
rm
pluggable-deprecated.php
6263
0644
edit
dl
rm
pluggable.php
115970
0644
edit
dl
rm
plugin.php
35465
0644
edit
dl
rm
post-formats.php
7102
0644
edit
dl
rm
post-template.php
66880
0644
edit
dl
rm
post-thumbnail-template.php
10826
0644
edit
dl
rm
post.php
289894
0644
edit
dl
rm
query.php
37035
0644
edit
dl
rm
registration-functions.php
200
0644
edit
dl
rm
registration.php
200
0644
edit
dl
rm
rest-api.php
99593
0644
edit
dl
rm
revision.php
30890
0644
edit
dl
rm
rewrite.php
19541
0644
edit
dl
rm
robots-template.php
5185
0644
edit
dl
rm
rss-functions.php
255
0644
edit
dl
rm
rss.php
23113
0644
edit
dl
rm
script-loader.php
130735
0644
edit
dl
rm
script-modules.php
7712
0644
edit
dl
rm
session.php
258
0644
edit
dl
rm
shortcodes.php
24051
0644
edit
dl
rm
sitemaps.php
3238
0644
edit
dl
rm
spl-autoload-compat.php
441
0644
edit
dl
rm
style-engine.php
7563
0644
edit
dl
rm
taxonomy.php
175438
0644
edit
dl
rm
template-canvas.php
544
0644
edit
dl
rm
template-loader.php
3350
0644
edit
dl
rm
template.php
24154
0644
edit
dl
rm
theme-i18n.json
1292
0644
edit
dl
rm
theme-previews.php
2832
0644
edit
dl
rm
theme-templates.php
6223
0644
edit
dl
rm
theme.json
8704
0644
edit
dl
rm
theme.php
133985
0644
edit
dl
rm
update.php
36788
0644
edit
dl
rm
user.php
175058
0644
edit
dl
rm
vars.php
6489
0644
edit
dl
rm
version.php
931
0644
edit
dl
rm
widgets.php
70682
0644
edit
dl
rm
wp-db.php
445
0644
edit
dl
rm
wp-diff.php
726
0644
edit
dl
rm
Edit:
/home/altere25/quintelacrosse.com/wp-includes/block-template.php
(14142B)
<?php /** * Block template loader functions. * * @package WordPress */ /** * Adds necessary hooks to resolve '_wp-find-template' requests. * * @access private * @since 5.9.0 */ function _add_template_loader_filters() { if ( isset( $_GET['_wp-find-template'] ) && current_theme_supports( 'block-templates' ) ) { add_action( 'pre_get_posts', '_resolve_template_for_new_post' ); } } /** * Finds a block template with equal or higher specificity than a given PHP template file. * * Internally, this communicates the block content that needs to be used by the template canvas through a global variable. * * @since 5.8.0 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar. * * @global string $_wp_current_template_content * @global string $_wp_current_template_id * * @param string $template Path to the template. See locate_template(). * @param string $type Sanitized filename without extension. * @param string[] $templates A list of template candidates, in descending order of priority. * @return string The path to the Site Editor template canvas file, or the fallback PHP template. */ function locate_block_template( $template, $type, array $templates ) { global $_wp_current_template_content, $_wp_current_template_id; if ( ! current_theme_supports( 'block-templates' ) ) { return $template; } if ( $template ) { /* * locate_template() has found a PHP template at the path specified by $template. * That means that we have a fallback candidate if we cannot find a block template * with higher specificity. * * Thus, before looking for matching block themes, we shorten our list of candidate * templates accordingly. */ // Locate the index of $template (without the theme directory path) in $templates. $relative_template_path = str_replace( array( get_stylesheet_directory() . '/', get_template_directory() . '/' ), '', $template ); $index = array_search( $relative_template_path, $templates, true ); // If the template hierarchy algorithm has successfully located a PHP template file, // we will only consider block templates with higher or equal specificity. $templates = array_slice( $templates, 0, $index + 1 ); } $block_template = resolve_block_template( $type, $templates, $template ); if ( $block_template ) { $_wp_current_template_id = $block_template->id; if ( empty( $block_template->content ) && is_user_logged_in() ) { $_wp_current_template_content = sprintf( /* translators: %s: Template title */ __( 'Empty template: %s' ), $block_template->title ); } elseif ( ! empty( $block_template->content ) ) { $_wp_current_template_content = $block_template->content; } if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_success( $block_template ); } } else { if ( $template ) { return $template; } if ( 'index' === $type ) { if ( isset( $_GET['_wp-find-template'] ) ) { wp_send_json_error( array( 'message' => __( 'No matching template found.' ) ) ); } } else { return ''; // So that the template loader keeps looking for templates. } } // Add hooks for template canvas. // Add viewport meta tag. add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 ); // Render title tag with content, regardless of whether theme has title-tag support. remove_action( 'wp_head', '_wp_render_title_tag', 1 ); // Remove conditional title tag rendering... add_action( 'wp_head', '_block_template_render_title_tag', 1 ); // ...and make it unconditional. // This file will be included instead of the theme's template file. return ABSPATH . WPINC . '/template-canvas.php'; } /** * Returns the correct 'wp_template' to render for the request template type. * * @access private * @since 5.8.0 * @since 5.9.0 Added the `$fallback_template` parameter. * * @param string $template_type The current template type. * @param string[] $template_hierarchy The current template hierarchy, ordered by priority. * @param string $fallback_template A PHP fallback template to use if no matching block template is found. * @return WP_Block_Template|null template A template object, or null if none could be found. */ function resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) { if ( ! $template_type ) { return null; } if ( empty( $template_hierarchy ) ) { $template_hierarchy = array( $template_type ); } $slugs = array_map( '_strip_template_file_suffix', $template_hierarchy ); // Find all potential templates 'wp_template' post matching the hierarchy. $query = array( 'slug__in' => $slugs, ); $templates = get_block_templates( $query ); // Order these templates per slug priority. // Build map of template slugs to their priority in the current hierarchy. $slug_priorities = array_flip( $slugs ); usort( $templates, static function ( $template_a, $template_b ) use ( $slug_priorities ) { return $slug_priorities[ $template_a->slug ] - $slug_priorities[ $template_b->slug ]; } ); $theme_base_path = get_stylesheet_directory() . DIRECTORY_SEPARATOR; $parent_theme_base_path = get_template_directory() . DIRECTORY_SEPARATOR; // Is the active theme a child theme, and is the PHP fallback template part of it? if ( str_starts_with( $fallback_template, $theme_base_path ) && ! str_contains( $fallback_template, $parent_theme_base_path ) ) { $fallback_template_slug = substr( $fallback_template, // Starting position of slug. strpos( $fallback_template, $theme_base_path ) + strlen( $theme_base_path ), // Remove '.php' suffix. -4 ); // Is our candidate block template's slug identical to our PHP fallback template's? if ( count( $templates ) && $fallback_template_slug === $templates[0]->slug && 'theme' === $templates[0]->source ) { // Unfortunately, we cannot trust $templates[0]->theme, since it will always // be set to the active theme's slug by _build_block_template_result_from_file(), // even if the block template is really coming from the active theme's parent. // (The reason for this is that we want it to be associated with the active theme // -- not its parent -- once we edit it and store it to the DB as a wp_template CPT.) // Instead, we use _get_block_template_file() to locate the block template file. $template_file = _get_block_template_file( 'wp_template', $fallback_template_slug ); if ( $template_file && get_template() === $template_file['theme'] ) { // The block template is part of the parent theme, so we // have to give precedence to the child theme's PHP template. array_shift( $templates ); } } } return count( $templates ) ? $templates[0] : null; } /** * Displays title tag with content, regardless of whether theme has title-tag support. * * @access private * @since 5.8.0 * * @see _wp_render_title_tag() */ function _block_template_render_title_tag() { echo '<title>' . wp_get_document_title() . '</title>' . "\n"; } /** * Returns the markup for the current template. * * @access private * @since 5.8.0 * * @global string $_wp_current_template_id * @global string $_wp_current_template_content * @global WP_Embed $wp_embed WordPress Embed object. * @global WP_Query $wp_query WordPress Query object. * * @return string Block template markup. */ function get_the_block_template_html() { global $_wp_current_template_id, $_wp_current_template_content, $wp_embed, $wp_query; if ( ! $_wp_current_template_content ) { if ( is_user_logged_in() ) { return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>'; } return; } $content = $wp_embed->run_shortcode( $_wp_current_template_content ); $content = $wp_embed->autoembed( $content ); $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); /* * Most block themes omit the `core/query` and `core/post-template` blocks in their singular content templates. * While this technically still works since singular content templates are always for only one post, it results in * the main query loop never being entered which causes bugs in core and the plugin ecosystem. * * The workaround below ensures that the loop is started even for those singular templates. The while loop will by * definition only go through a single iteration, i.e. `do_blocks()` is only called once. Additional safeguard * checks are included to ensure the main query loop has not been tampered with and really only encompasses a * single post. * * Even if the block template contained a `core/query` and `core/post-template` block referencing the main query * loop, it would not cause errors since it would use a cloned instance and go through the same loop of a single * post, within the actual main query loop. * * This special logic should be skipped if the current template does not come from the current theme, in which case * it has been injected by a plugin by hijacking the block template loader mechanism. In that case, entirely custom * logic may be applied which is unpredictable and therefore safer to omit this special handling on. */ if ( $_wp_current_template_id && str_starts_with( $_wp_current_template_id, get_stylesheet() . '//' ) && is_singular() && 1 === $wp_query->post_count && have_posts() ) { while ( have_posts() ) { the_post(); $content = do_blocks( $content ); } } else { $content = do_blocks( $content ); } $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = wp_filter_content_tags( $content, 'template' ); $content = str_replace( ']]>', ']]>', $content ); // Wrap block template in .wp-site-blocks to allow for specific descendant styles // (e.g. `.wp-site-blocks > *`). return '<div class="wp-site-blocks">' . $content . '</div>'; } /** * Renders a 'viewport' meta tag. * * This is hooked into {@see 'wp_head'} to decouple its output from the default template canvas. * * @access private * @since 5.8.0 */ function _block_template_viewport_meta_tag() { echo '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "\n"; } /** * Strips .php or .html suffix from template file names. * * @access private * @since 5.8.0 * * @param string $template_file Template file name. * @return string Template file name without extension. */ function _strip_template_file_suffix( $template_file ) { return preg_replace( '/\.(php|html)$/', '', $template_file ); } /** * Removes post details from block context when rendering a block template. * * @access private * @since 5.8.0 * * @param array $context Default context. * * @return array Filtered context. */ function _block_template_render_without_post_block_context( $context ) { /* * When loading a template directly and not through a page that resolves it, * the top-level post ID and type context get set to that of the template. * Templates are just the structure of a site, and they should not be available * as post context because blocks like Post Content would recurse infinitely. */ if ( isset( $context['postType'] ) && 'wp_template' === $context['postType'] ) { unset( $context['postId'] ); unset( $context['postType'] ); } return $context; } /** * Sets the current WP_Query to return auto-draft posts. * * The auto-draft status indicates a new post, so allow the the WP_Query instance to * return an auto-draft post for template resolution when editing a new post. * * @access private * @since 5.9.0 * * @param WP_Query $wp_query Current WP_Query instance, passed by reference. */ function _resolve_template_for_new_post( $wp_query ) { if ( ! $wp_query->is_main_query() ) { return; } remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' ); // Pages. $page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null; // Posts, including custom post types. $p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null; $post_id = $page_id ? $page_id : $p; $post = get_post( $post_id ); if ( $post && 'auto-draft' === $post->post_status && current_user_can( 'edit_post', $post->ID ) ) { $wp_query->set( 'post_status', 'auto-draft' ); } } /** * Register a block template. * * @since 6.7.0 * * @param string $template_name Template name in the form of `plugin_uri//template_name`. * @param array|string $args { * @type string $title Optional. Title of the template as it will be shown in the Site Editor * and other UI elements. * @type string $description Optional. Description of the template as it will be shown in the Site * Editor. * @type string $content Optional. Default content of the template that will be used when the * template is rendered or edited in the editor. * @type string[] $post_types Optional. Array of post types to which the template should be available. * @type string $plugin Optional. Slug of the plugin that registers the template. * } * @return WP_Block_Template|WP_Error The registered template object on success, WP_Error object on failure. */ function register_block_template( $template_name, $args = array() ) { return WP_Block_Templates_Registry::get_instance()->register( $template_name, $args ); } /** * Unregister a block template. * * @since 6.7.0 * * @param string $template_name Template name in the form of `plugin_uri//template_name`. * @return WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if the * template doesn't exist. */ function unregister_block_template( $template_name ) { return WP_Block_Templates_Registry::get_instance()->unregister( $template_name ); }
Save
cmd:
run