Plugin info

Total downloads: 5,673
Active installs: 10
Total reviews: 0
Average rating: 0
Support threads opened: 0
Support threads resolved: 0 (0%)
Available in: 1 language(s)
Contributors: 2
Last updated: 4/23/2025 (252 days ago)
Added to WordPress: 9/27/2010 (15 years old)
Minimum WordPress version: 3.6
Tested up to WordPress version: 6.8.3
Minimum PHP version: f

Maintenance & Compatibility

Maintenance score

Stale • Last updated 252 days ago

38/100

Is Inject Query Posts abandoned?

Likely maintained (last update 252 days ago).

Compatibility

Requires WordPress: 3.6
Tested up to: 6.8.3
Requires PHP: f

Similar & Alternatives

Explore plugins with similar tags, and compare key metrics like downloads, ratings, updates, support, and WP/PHP compatibility.

Custom Excerpts
Rating 0.0/5 (0 reviews)Active installs 50
Copyright Autoupdater
Rating 1.0/5 (1 reviews)Active installs 10
Post Index Helpers
Rating 0.0/5 (0 reviews)Active installs 10

Description

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:



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

    Developer Documentation

    Developer documentation can be found in DEVELOPER-DOCS.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.

    Installation

    1. Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically /wp-content/plugins/).
    2. Activate the plugin through the ‘Plugins’ admin menu in WordPress
    3. Use the c2c_inject_query_posts() function to inject an array of posts into a WP query object. Specify the posts array as the first argument. Configure the query object by passing an array as the second argument. If specifying a WP query object, pass it as the third object; if not specified then the global wp_query object will be assumed.

    Frequently Asked Questions

    No FAQ available

    Review feed

    No reviews available

    Screenshots

    No screenshots available

    Changelog

    3.0.5 (2025-04-22)

    • Change: Note compatibility through WP 6.8+
    • Change: Note compatibility through PHP 8.3+
    • Change: Update copyright date (2025)
    • Unit tests:
      • Change: Explicitly define return type for overridden method

    3.0.4 (2024-08-02)

    • Change: Note compatibility through WP 6.6+
    • Change: Update copyright date (2024)
    • New: Add .gitignore file
    • Change: Reduce number of ‘Tags’ from readme.txt
    • Change: Remove development and testing-related files from release packaging
    • Unit tests:
      • Hardening: Prevent direct web access to bootstrap.php
      • Allow tests to run against current versions of WordPress
      • New: Add composer.json for PHPUnit Polyfill dependency
      • Change: In bootstrap, store path to plugin directory in a constant

    3.0.3 (2023-05-18)

    • Change: Add link to DEVELOPER-DOCS.md to README.md
    • Change: Tweak installation instruction
    • Change: Tweak some documentation text spacing and fix a typo
    • Change: Note compatibility through WP 6.3+
    • Change: Update copyright date (2023)
    • New: Add a potential TODO feature

    Full changelog is available in CHANGELOG.md.