Skip to content

Commit

Permalink
Annotated WordPress core file requires
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Nov 19, 2024
1 parent 567802c commit b9f3e02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/php/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ function copy_images() {
* @return void
*/
function copy_image( $path, $title ) {
// Bail if image already exists.
// @phpstan-ignore requireOnce.fileNotFound (WordPress file)
require_once ABSPATH . 'wp-admin/includes/post.php';
// Bail if image already exists.
if ( 0 !== post_exists( $title, '', '', 'attachment' ) ) {
return;
}
Expand All @@ -134,6 +135,7 @@ function copy_image( $path, $title ) {
if ( is_wp_error( $attachment_id ) ) {
throw new \Exception();
}
// @phpstan-ignore requireOnce.fileNotFound (WordPress file)
require_once ABSPATH . 'wp-admin/includes/image.php';
// @phpstan-ignore-next-line
$attachment_metadata = wp_generate_attachment_metadata( $attachment_id, $file_contents['file'] );
Expand Down

0 comments on commit b9f3e02

Please sign in to comment.