Articles of wp query

How to get old posts instead of recent with WP_Query?

I’m doing a WP_Query with a date_query parameter after, and I want the nearest post after that date, but I get the farest ones in the future from the date. Is there any parameter to control this? something like ‘near_to’ => ‘past/future’, or WP_Query always retrieve the most recent? This is my code: $my_query = […]

Child pages not affected by orderby

My loop won’t order the child pages I’m displaying in the order I want them to, neither ASC or DESC. I’ve already seen many other similar issues, but those were resolved with disabling plugins (which I don’t have) or removing or adding quotes (which I’ve checked multiple times). <?php $args = array( ‘post_type’ => ‘page’, […]

Display recent posts on another site

I have created a recent post type plugin and it displays recent posts from another website, but the permalinks are not working properly. The permalink does not show the post’s URL, it shows the same website URL. Can anyone help me? Here is my own code: // db parameters $db_hostname = ‘localhost’; $db_username = ‘root’; […]

Querying a large number of posts including their custom fields data

I’m building a SVG map separated into about 200 regions. For each region there are attributes that describe it, as well as a region ID. These regions are just polygons in the SVG. I setup a custom post type so that the data associated with these regions could be added in the dashboard, and upon […]

Get the child category ID of current category

I am trying to get the category ID of the child (no grand children) of the current category. Using below method: $category = get_category(get_query_var( ‘cat’ )); // get category ID $catid = $category->cat_ID; I can get the current category ID. However, using this in WP_Query result in displaying the posts that are published in Parent, […]

Query posts by specific word on title

Is it possible to query posts by a specific word on title? Example: I have 3 posts inside my blog and only two have the word car on the title. She wants a ride on my truck My car is super fast Her car is yellow If this is possible, query should return only posts […]

WP User Query get all authors with last name starting with specific letter

I need to program a page to which I pass an initial through the url and it will show all author users whose last name starts with that letter. I would like to do this via WP User Query so that I can easily loop over the results Right now I have this: <?php $letter […]

Write WP Query that selects posts that are part of the same two categories

How would I go about writing an intersect query (using WP Query) that returns a set of posts that are in both category A and category B?

Add URL Rewrite Rule To WordPress

my link http://localhost/abm/?ct_city=la-jolla&search-listings=true i want to this http://localhost/abm/USA/la-jolla Could you help please.. htpaccss file # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /abm/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /abm/index.php? [L] </IfModule> # END WordPress

How to get posts by category and by choosing a taxonomy term?

I’m new to WordPress and I’ve managed to build most of a full custom theme for wordpress on my own. But the tricky stuff is starting to show its tail, and I’ve spent the last days stuck on Taxonomies. I just managed to put a code for registering a custom Taxonomy to sort my articles […]