Get URL from all images in a post

You probably can’t find any attached images because those images are not considered ‘attached’ or have been attached to another post before. With this script you can search directly in the_content() for all the attached images and then create another list with only the <img> tags cleaned from the rest of the text. $post_content = … Read more

WordPress post page not working properly

Your first screenshot is the block editor. The new editor introduced in WordPress 5.0. It is the default editor, so yes, it is what you “should” get when creating a post. The second screenshot shows the classic editor, which is often still used for custom post types. If you want to use this editor for … Read more

Very complex post query

I got inspired in solving my problem by this thread! The idea is to create individual queries (unordered to save time, as sorting is not needed at this stage) to get the post IDs that meet your criteria; then take those IDs and run a final query with the IDs as the criteria to get … Read more

WordPress query undefined offset in loop

There might be other causes to the issue in question, but one issue I noticed in your code is that because you are looping through a custom WP_Query instance, i.e. $loop, then you need to use $loop->the_post() instead of just the_post(): while ( $loop->have_posts() ) { $loop->the_post(); the_title(); } And you could see that I … Read more

Query within a foreach within a query (queryception)

Good for you that you’ve corrected the $posts that was undefined, but then: There’s no need to call $the_query->get_posts() because when WP_Query is instantiated with a non-empty query, e.g. new WP_Query( ‘post_type=house’ ) (contains one query arg — post_type) as opposed to new WP_Query() (no query args specified), the get_posts() method in that class will … Read more

Make loop inside slider divisible [closed]

Unfortunatelly, I didn’t understand your question right, but I see only 2 possible problems here. Here you will need to use: $blog->current_post – current post index $blog->post_count – total posts If you need to wrap each 4 posts with a div, and if there are less then 4 posts in the end, wrap them to. … Read more

search blog posts by author first name and or last name

Actually, when you set author_name, WP_Query will use get_user_by( ‘slug’, <author name> ) to find a user with the specified “nice name” (user_nicename) value, and if found, then WP_Query sets the author arg to the found user’s ID. Therefore you can follow the same approach, but you would use get_users() to find users having the … Read more