PHPackages                             timohubois/post-type-and-taxonomy-archive-pages - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. timohubois/post-type-and-taxonomy-archive-pages

ActiveWordpress-plugin

timohubois/post-type-and-taxonomy-archive-pages
===============================================

Set the archive for your custom post types to associate them with a specific page and control the permalinks for single custom post type pages and custom taxonomies.

2.2.3(4mo ago)723GPL-3.0-or-laterPHPPHP ^8.0CI passing

Since Jul 8Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/timohubois/post-type-archive-pages-and-permalink-settings)[ Packagist](https://packagist.org/packages/timohubois/post-type-and-taxonomy-archive-pages)[ RSS](/packages/timohubois-post-type-and-taxonomy-archive-pages/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (22)Used By (0)

Post Type and Taxonomy Archive Pages Settings
=============================================

[](#post-type-and-taxonomy-archive-pages-settings)

Post Type and Taxonomy Archive Pages Settings enables to select a page that should interact as archive for custom post types. It also enables to change the slug for custom post type single pages or custom taxonomies.

The Plugin extends the native **Reading** and **Permalinks** settings pages:

- Settings &gt; **Reading** &gt; Adds a section to select a page which should interact as archive for a custom post type.
- Settings &gt; **Permalinks** &gt; Adds a section to change the slug for custom post types and custom taxonomies.

How to programmatically get the post used as the archive page for a custom post type?
-------------------------------------------------------------------------------------

[](#how-to-programmatically-get-the-post-used-as-the-archive-page-for-a-custom-post-type)

Example how to retrieve the post object of the page set as the archive for a custom post type:

```
/**
 * Retrieves the post object for a given post type's archive page.
 *
 * @param string|null $postType The post type to retrieve the archive page for.
 * @return WP_Post|null WP_Post on success, or null on failure.
 */
function getCustomPostTypeArchivePage(?string $postType = null): ?\WP_Post
{
    $postType = $postType ?? getCurrentQueryPostType();

    if ($postType === null) {
        return null;
    }

    $postTypeObject = get_post_type_object($postType);

    if (!$postTypeObject || !$postTypeObject->has_archive) {
        return null;
    }

    $archiveSlug = $postTypeObject->has_archive;

    if (!is_string($archiveSlug)) {
        return null;
    }

    $archivePage = get_page_by_path($archiveSlug);

    return ($archivePage instanceof \WP_Post) ? $archivePage : null;
}

/**
 * Retrieves the current post type from the global $wp_query object.
 *
 * @return string|null The current post type, or null if not found.
 */
function getCurrentQueryPostType(): ?string
{
    global $wp_query;
    return $wp_query->query['post_type'] ?? null;
}

$archivePage = getCustomPostTypeArchivePage('your_custom_post_type');
if ($archivePage) {
    echo "Archive page title: " . $archivePage->post_title;
    echo "Archive page ID: " . $archivePage->ID;
    echo "Archive page URL: " . get_permalink($archivePage->ID);
} else {
    echo "No archive page found for this post type.";
}
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0

Installation
------------

[](#installation)

1. Make sure you have the correct [requirements](#requirements).
2. Clone the repository and place it in `wp-content/plugins/` folder.

Development
-----------

[](#development)

1. Make sure you have the correct [requirements](#requirements).
2. Perform [Installation](#installation).
3. Run `composer i` to install composer dependency.

License
-------

[](#license)

GPLv3

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance76

Regular maintenance activity

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~48 days

Total

19

Last Release

148d ago

Major Versions

1.9.0.1 → 2.0.02025-05-02

PHP version history (2 changes)1.4PHP &gt;=8.0

1.6PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/082b8e18f406266b8525a63648a3d5bee68f69de2b18275aac15699cabc23513?d=identicon)[timo](/maintainers/timo)

---

Top Contributors

[![timohubois](https://avatars.githubusercontent.com/u/46505685?v=4)](https://github.com/timohubois "timohubois (142 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

wordpress-plugin

###  Code Quality

Static AnalysisRector

### Embed Badge

![Health badge](/badges/timohubois-post-type-and-taxonomy-archive-pages/health.svg)

```
[![Health](https://phpackages.com/badges/timohubois-post-type-and-taxonomy-archive-pages/health.svg)](https://phpackages.com/packages/timohubois-post-type-and-taxonomy-archive-pages)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
