greater flexibility in targeting images attached to page

Every file that is uploaded in WordPress is an Attachment, which is a kind of post ('post_type' => 'attachment').

When the file is uploaded inside a Post or Page, it is attached to that particular post/page ('post_parent' => $post->ID).
enter image description here

I can think of a solution that doesn’t involves any particular coding:

  • you simply have to put an order in your gallery images ('orderby'=> 'menu_order') and set the number of posts (of the attachment type) to be grabbed as four ('numberposts' => 4).
    enter image description here
    image source

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.