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.../httpdocs/clone/wp-inclu...
File: post.php
/**
[8000] Fix | Delete
* Adds a suffix if any trashed posts have a given slug.
[8001] Fix | Delete
*
[8002] Fix | Delete
* Store its desired (i.e. current) slug so it can try to reclaim it
[8003] Fix | Delete
* if the post is untrashed.
[8004] Fix | Delete
*
[8005] Fix | Delete
* For internal use.
[8006] Fix | Delete
*
[8007] Fix | Delete
* @since 4.5.0
[8008] Fix | Delete
* @access private
[8009] Fix | Delete
*
[8010] Fix | Delete
* @param string $post_name Post slug.
[8011] Fix | Delete
* @param int $post_id Optional. Post ID that should be ignored. Default 0.
[8012] Fix | Delete
*/
[8013] Fix | Delete
function wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_id = 0 ) {
[8014] Fix | Delete
$trashed_posts_with_desired_slug = get_posts(
[8015] Fix | Delete
array(
[8016] Fix | Delete
'name' => $post_name,
[8017] Fix | Delete
'post_status' => 'trash',
[8018] Fix | Delete
'post_type' => 'any',
[8019] Fix | Delete
'nopaging' => true,
[8020] Fix | Delete
'post__not_in' => array( $post_id ),
[8021] Fix | Delete
)
[8022] Fix | Delete
);
[8023] Fix | Delete
[8024] Fix | Delete
if ( ! empty( $trashed_posts_with_desired_slug ) ) {
[8025] Fix | Delete
foreach ( $trashed_posts_with_desired_slug as $_post ) {
[8026] Fix | Delete
wp_add_trashed_suffix_to_post_name_for_post( $_post );
[8027] Fix | Delete
}
[8028] Fix | Delete
}
[8029] Fix | Delete
}
[8030] Fix | Delete
[8031] Fix | Delete
/**
[8032] Fix | Delete
* Adds a trashed suffix for a given post.
[8033] Fix | Delete
*
[8034] Fix | Delete
* Store its desired (i.e. current) slug so it can try to reclaim it
[8035] Fix | Delete
* if the post is untrashed.
[8036] Fix | Delete
*
[8037] Fix | Delete
* For internal use.
[8038] Fix | Delete
*
[8039] Fix | Delete
* @since 4.5.0
[8040] Fix | Delete
* @access private
[8041] Fix | Delete
*
[8042] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[8043] Fix | Delete
*
[8044] Fix | Delete
* @param WP_Post $post The post.
[8045] Fix | Delete
* @return string New slug for the post.
[8046] Fix | Delete
*/
[8047] Fix | Delete
function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
[8048] Fix | Delete
global $wpdb;
[8049] Fix | Delete
[8050] Fix | Delete
$post = get_post( $post );
[8051] Fix | Delete
[8052] Fix | Delete
if ( str_ends_with( $post->post_name, '__trashed' ) ) {
[8053] Fix | Delete
return $post->post_name;
[8054] Fix | Delete
}
[8055] Fix | Delete
add_post_meta( $post->ID, '_wp_desired_post_slug', $post->post_name );
[8056] Fix | Delete
$post_name = _truncate_post_slug( $post->post_name, 191 ) . '__trashed';
[8057] Fix | Delete
$wpdb->update( $wpdb->posts, array( 'post_name' => $post_name ), array( 'ID' => $post->ID ) );
[8058] Fix | Delete
clean_post_cache( $post->ID );
[8059] Fix | Delete
return $post_name;
[8060] Fix | Delete
}
[8061] Fix | Delete
[8062] Fix | Delete
/**
[8063] Fix | Delete
* Sets the last changed time for the 'posts' cache group.
[8064] Fix | Delete
*
[8065] Fix | Delete
* @since 5.0.0
[8066] Fix | Delete
*/
[8067] Fix | Delete
function wp_cache_set_posts_last_changed() {
[8068] Fix | Delete
wp_cache_set_last_changed( 'posts' );
[8069] Fix | Delete
}
[8070] Fix | Delete
[8071] Fix | Delete
/**
[8072] Fix | Delete
* Gets all available post MIME types for a given post type.
[8073] Fix | Delete
*
[8074] Fix | Delete
* @since 2.5.0
[8075] Fix | Delete
*
[8076] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[8077] Fix | Delete
*
[8078] Fix | Delete
* @param string $type
[8079] Fix | Delete
* @return string[] An array of MIME types.
[8080] Fix | Delete
*/
[8081] Fix | Delete
function get_available_post_mime_types( $type = 'attachment' ) {
[8082] Fix | Delete
global $wpdb;
[8083] Fix | Delete
[8084] Fix | Delete
/**
[8085] Fix | Delete
* Filters the list of available post MIME types for the given post type.
[8086] Fix | Delete
*
[8087] Fix | Delete
* @since 6.4.0
[8088] Fix | Delete
*
[8089] Fix | Delete
* @param string[]|null $mime_types An array of MIME types. Default null.
[8090] Fix | Delete
* @param string $type The post type name. Usually 'attachment' but can be any post type.
[8091] Fix | Delete
*/
[8092] Fix | Delete
$mime_types = apply_filters( 'pre_get_available_post_mime_types', null, $type );
[8093] Fix | Delete
[8094] Fix | Delete
if ( ! is_array( $mime_types ) ) {
[8095] Fix | Delete
$mime_types = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_mime_type FROM $wpdb->posts WHERE post_type = %s AND post_mime_type != ''", $type ) );
[8096] Fix | Delete
}
[8097] Fix | Delete
[8098] Fix | Delete
// Remove nulls from returned $mime_types.
[8099] Fix | Delete
return array_values( array_filter( $mime_types ) );
[8100] Fix | Delete
}
[8101] Fix | Delete
[8102] Fix | Delete
/**
[8103] Fix | Delete
* Retrieves the path to an uploaded image file.
[8104] Fix | Delete
*
[8105] Fix | Delete
* Similar to `get_attached_file()` however some images may have been processed after uploading
[8106] Fix | Delete
* to make them suitable for web use. In this case the attached "full" size file is usually replaced
[8107] Fix | Delete
* with a scaled down version of the original image. This function always returns the path
[8108] Fix | Delete
* to the originally uploaded image file.
[8109] Fix | Delete
*
[8110] Fix | Delete
* @since 5.3.0
[8111] Fix | Delete
* @since 5.4.0 Added the `$unfiltered` parameter.
[8112] Fix | Delete
*
[8113] Fix | Delete
* @param int $attachment_id Attachment ID.
[8114] Fix | Delete
* @param bool $unfiltered Optional. Passed through to `get_attached_file()`. Default false.
[8115] Fix | Delete
* @return string|false Path to the original image file or false if the attachment is not an image.
[8116] Fix | Delete
*/
[8117] Fix | Delete
function wp_get_original_image_path( $attachment_id, $unfiltered = false ) {
[8118] Fix | Delete
if ( ! wp_attachment_is_image( $attachment_id ) ) {
[8119] Fix | Delete
return false;
[8120] Fix | Delete
}
[8121] Fix | Delete
[8122] Fix | Delete
$image_meta = wp_get_attachment_metadata( $attachment_id );
[8123] Fix | Delete
$image_file = get_attached_file( $attachment_id, $unfiltered );
[8124] Fix | Delete
[8125] Fix | Delete
if ( empty( $image_meta['original_image'] ) ) {
[8126] Fix | Delete
$original_image = $image_file;
[8127] Fix | Delete
} else {
[8128] Fix | Delete
$original_image = path_join( dirname( $image_file ), $image_meta['original_image'] );
[8129] Fix | Delete
}
[8130] Fix | Delete
[8131] Fix | Delete
/**
[8132] Fix | Delete
* Filters the path to the original image.
[8133] Fix | Delete
*
[8134] Fix | Delete
* @since 5.3.0
[8135] Fix | Delete
*
[8136] Fix | Delete
* @param string $original_image Path to original image file.
[8137] Fix | Delete
* @param int $attachment_id Attachment ID.
[8138] Fix | Delete
*/
[8139] Fix | Delete
return apply_filters( 'wp_get_original_image_path', $original_image, $attachment_id );
[8140] Fix | Delete
}
[8141] Fix | Delete
[8142] Fix | Delete
/**
[8143] Fix | Delete
* Retrieves the URL to an original attachment image.
[8144] Fix | Delete
*
[8145] Fix | Delete
* Similar to `wp_get_attachment_url()` however some images may have been
[8146] Fix | Delete
* processed after uploading. In this case this function returns the URL
[8147] Fix | Delete
* to the originally uploaded image file.
[8148] Fix | Delete
*
[8149] Fix | Delete
* @since 5.3.0
[8150] Fix | Delete
*
[8151] Fix | Delete
* @param int $attachment_id Attachment post ID.
[8152] Fix | Delete
* @return string|false Attachment image URL, false on error or if the attachment is not an image.
[8153] Fix | Delete
*/
[8154] Fix | Delete
function wp_get_original_image_url( $attachment_id ) {
[8155] Fix | Delete
if ( ! wp_attachment_is_image( $attachment_id ) ) {
[8156] Fix | Delete
return false;
[8157] Fix | Delete
}
[8158] Fix | Delete
[8159] Fix | Delete
$image_url = wp_get_attachment_url( $attachment_id );
[8160] Fix | Delete
[8161] Fix | Delete
if ( ! $image_url ) {
[8162] Fix | Delete
return false;
[8163] Fix | Delete
}
[8164] Fix | Delete
[8165] Fix | Delete
$image_meta = wp_get_attachment_metadata( $attachment_id );
[8166] Fix | Delete
[8167] Fix | Delete
if ( empty( $image_meta['original_image'] ) ) {
[8168] Fix | Delete
$original_image_url = $image_url;
[8169] Fix | Delete
} else {
[8170] Fix | Delete
$original_image_url = path_join( dirname( $image_url ), $image_meta['original_image'] );
[8171] Fix | Delete
}
[8172] Fix | Delete
[8173] Fix | Delete
/**
[8174] Fix | Delete
* Filters the URL to the original attachment image.
[8175] Fix | Delete
*
[8176] Fix | Delete
* @since 5.3.0
[8177] Fix | Delete
*
[8178] Fix | Delete
* @param string $original_image_url URL to original image.
[8179] Fix | Delete
* @param int $attachment_id Attachment ID.
[8180] Fix | Delete
*/
[8181] Fix | Delete
return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id );
[8182] Fix | Delete
}
[8183] Fix | Delete
[8184] Fix | Delete
/**
[8185] Fix | Delete
* Filters callback which sets the status of an untrashed post to its previous status.
[8186] Fix | Delete
*
[8187] Fix | Delete
* This can be used as a callback on the `wp_untrash_post_status` filter.
[8188] Fix | Delete
*
[8189] Fix | Delete
* @since 5.6.0
[8190] Fix | Delete
*
[8191] Fix | Delete
* @param string $new_status The new status of the post being restored.
[8192] Fix | Delete
* @param int $post_id The ID of the post being restored.
[8193] Fix | Delete
* @param string $previous_status The status of the post at the point where it was trashed.
[8194] Fix | Delete
* @return string The new status of the post.
[8195] Fix | Delete
*/
[8196] Fix | Delete
function wp_untrash_post_set_previous_status( $new_status, $post_id, $previous_status ) {
[8197] Fix | Delete
return $previous_status;
[8198] Fix | Delete
}
[8199] Fix | Delete
[8200] Fix | Delete
/**
[8201] Fix | Delete
* Returns whether the post can be edited in the block editor.
[8202] Fix | Delete
*
[8203] Fix | Delete
* @since 5.0.0
[8204] Fix | Delete
* @since 6.1.0 Moved to wp-includes from wp-admin.
[8205] Fix | Delete
*
[8206] Fix | Delete
* @param int|WP_Post $post Post ID or WP_Post object.
[8207] Fix | Delete
* @return bool Whether the post can be edited in the block editor.
[8208] Fix | Delete
*/
[8209] Fix | Delete
function use_block_editor_for_post( $post ) {
[8210] Fix | Delete
$post = get_post( $post );
[8211] Fix | Delete
[8212] Fix | Delete
if ( ! $post ) {
[8213] Fix | Delete
return false;
[8214] Fix | Delete
}
[8215] Fix | Delete
[8216] Fix | Delete
// We're in the meta box loader, so don't use the block editor.
[8217] Fix | Delete
if ( is_admin() && isset( $_GET['meta-box-loader'] ) ) {
[8218] Fix | Delete
check_admin_referer( 'meta-box-loader', 'meta-box-loader-nonce' );
[8219] Fix | Delete
return false;
[8220] Fix | Delete
}
[8221] Fix | Delete
[8222] Fix | Delete
$use_block_editor = use_block_editor_for_post_type( $post->post_type );
[8223] Fix | Delete
[8224] Fix | Delete
/**
[8225] Fix | Delete
* Filters whether a post is able to be edited in the block editor.
[8226] Fix | Delete
*
[8227] Fix | Delete
* @since 5.0.0
[8228] Fix | Delete
*
[8229] Fix | Delete
* @param bool $use_block_editor Whether the post can be edited or not.
[8230] Fix | Delete
* @param WP_Post $post The post being checked.
[8231] Fix | Delete
*/
[8232] Fix | Delete
return apply_filters( 'use_block_editor_for_post', $use_block_editor, $post );
[8233] Fix | Delete
}
[8234] Fix | Delete
[8235] Fix | Delete
/**
[8236] Fix | Delete
* Returns whether a post type is compatible with the block editor.
[8237] Fix | Delete
*
[8238] Fix | Delete
* The block editor depends on the REST API, and if the post type is not shown in the
[8239] Fix | Delete
* REST API, then it won't work with the block editor.
[8240] Fix | Delete
*
[8241] Fix | Delete
* @since 5.0.0
[8242] Fix | Delete
* @since 6.1.0 Moved to wp-includes from wp-admin.
[8243] Fix | Delete
*
[8244] Fix | Delete
* @param string $post_type The post type.
[8245] Fix | Delete
* @return bool Whether the post type can be edited with the block editor.
[8246] Fix | Delete
*/
[8247] Fix | Delete
function use_block_editor_for_post_type( $post_type ) {
[8248] Fix | Delete
if ( ! post_type_exists( $post_type ) ) {
[8249] Fix | Delete
return false;
[8250] Fix | Delete
}
[8251] Fix | Delete
[8252] Fix | Delete
if ( ! post_type_supports( $post_type, 'editor' ) ) {
[8253] Fix | Delete
return false;
[8254] Fix | Delete
}
[8255] Fix | Delete
[8256] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[8257] Fix | Delete
if ( $post_type_object && ! $post_type_object->show_in_rest ) {
[8258] Fix | Delete
return false;
[8259] Fix | Delete
}
[8260] Fix | Delete
[8261] Fix | Delete
/**
[8262] Fix | Delete
* Filters whether a post is able to be edited in the block editor.
[8263] Fix | Delete
*
[8264] Fix | Delete
* @since 5.0.0
[8265] Fix | Delete
*
[8266] Fix | Delete
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
[8267] Fix | Delete
* @param string $post_type The post type being checked.
[8268] Fix | Delete
*/
[8269] Fix | Delete
return apply_filters( 'use_block_editor_for_post_type', true, $post_type );
[8270] Fix | Delete
}
[8271] Fix | Delete
[8272] Fix | Delete
/**
[8273] Fix | Delete
* Registers any additional post meta fields.
[8274] Fix | Delete
*
[8275] Fix | Delete
* @since 6.3.0 Adds `wp_pattern_sync_status` meta field to the wp_block post type so an unsynced option can be added.
[8276] Fix | Delete
*
[8277] Fix | Delete
* @link https://github.com/WordPress/gutenberg/pull/51144
[8278] Fix | Delete
*/
[8279] Fix | Delete
function wp_create_initial_post_meta() {
[8280] Fix | Delete
register_post_meta(
[8281] Fix | Delete
'wp_block',
[8282] Fix | Delete
'wp_pattern_sync_status',
[8283] Fix | Delete
array(
[8284] Fix | Delete
'sanitize_callback' => 'sanitize_text_field',
[8285] Fix | Delete
'single' => true,
[8286] Fix | Delete
'type' => 'string',
[8287] Fix | Delete
'show_in_rest' => array(
[8288] Fix | Delete
'schema' => array(
[8289] Fix | Delete
'type' => 'string',
[8290] Fix | Delete
'enum' => array( 'partial', 'unsynced' ),
[8291] Fix | Delete
),
[8292] Fix | Delete
),
[8293] Fix | Delete
)
[8294] Fix | Delete
);
[8295] Fix | Delete
}
[8296] Fix | Delete
[8297] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function