WordPress.org

Make WordPress Core

Ticket #47466: 47466.diff

File 47466.diff, 1.3 KB (added by bradleyt, 4 months ago)
  • src/wp-admin/includes/misc.php

    diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
    index 6b46f67037..4852a372a1 100644
    a b function insert_with_markers( $filename, $marker, $insertion ) { 
    119119                $insertion = explode( "\n", $insertion );
    120120        }
    121121
     122        $instructions_markers = array();
     123        $instructions_markers[] = "#";
     124        $instructions_markers[] = "# The directives (lines) between `BEGIN {$marker}` and `END {$marker}` are dynamically generated,";
     125        $instructions_markers[] = "# and should only be modified through the use of WordPress filters.";
     126        $instructions_markers[] = "# Any changes to the directives between these markers will be overwritten.";
     127
     128        /**
     129         * Filters the inline instructions which are shown alongside dynamically generated markers.
     130         *
     131         * @since x.x.x
     132         *
     133         * @param string[] $instructions_markers Array of lines, containing inline instructions for insertion into the file.
     134         * @param string $marker The marker being inserted.
     135         */
     136        $instructions_markers = apply_filters( 'insert_with_markers_inline_instructions', $instructions_markers, $marker );
     137
     138        $insertion = array_merge($instructions_markers, $insertion);
     139
    122140        $start_marker = "# BEGIN {$marker}";
    123141        $end_marker   = "# END {$marker}";
    124142