WordPress plugin intelligence profile

Inject Query Posts

Facilitates injecting an array of posts into a WP query object as if queried. Particularly useful to allow use of standard template tags.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 6.8
Current version3.0.5
WordPress coverageTested up to WordPress 6.8
Minimum stackWP 3.6 · PHP —
Directory statusactive
Last directory update23 Apr 20251y ago
Active installations10Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Inject Query Posts version 3.0.5 as active, updated 1y ago and tested up to WordPress 6.8.

Overview

About this plugin

This plugin provides a function for use by developers who have their own code for fetching posts according to a given criteria and now want to make use of loop-aware template tags to display those posts.

WordPress’s template tags are intended to be used within ‘the loop’. The loop is managed by a WP_Query object which sets up various global variables and its own object variables for use by the various template tags. The primary purpose of a WP_Query object is to actually query the database for the posts that match the currently specified criteria.

However, if you don’t need to query for posts since you already have them by some other means, you can still take advantage of the template tags by injecting those posts into the WP_Query via this plugin.

Depending on the template tags you are looking to use, or the logic you are hoping to employ within a loop, you may need to manually configure some of the query object’s variables.

Example:

php // Say we're in the sidebar

// We've gotten some post objects on our own. $posts = c2c_get_random_posts( 5, '' );

// Inject the posts c2c_inject_query_posts( $posts );

>

></a></li>

>

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Developer Documentation

md. That documentation covers the template tag and hooks provided by the plugin.

As an overview, this is the template tag provided by the plugin:

  • c2c_inject_query_posts(): Template tag to inject an array of posts into a query object as if that query object had obtained those posts via a query.

These are the hooks provided by the plugin:

  • inject_query_posts_preserve_query_obj: Overrides the value of the $preserve_query_obj argument passed to the function. This is not typical usage for most users.
  • c2c_inject_query_posts: Allows use of an alternative approach to safely invoke c2c_inject_query_posts() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • template tags
  • wp query
  • loop
  • posts
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 6.8

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 6.8.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to6.8
Minimum requirementsWordPress 3.6 · PHP not listed
Update activity23 Apr 20251y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.