PHPackages                             ideasonpurpose/wp-theme-init - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ideasonpurpose/wp-theme-init

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ideasonpurpose/wp-theme-init
============================

A common baseline of repeated functions, filters and actions used across WordPress themes.

v2.20.0(1mo ago)02341[18 issues](https://github.com/ideasonpurpose/wp-theme-init/issues)MITPHP

Since Jun 15Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/ideasonpurpose/wp-theme-init)[ Packagist](https://packagist.org/packages/ideasonpurpose/wp-theme-init)[ RSS](/packages/ideasonpurpose-wp-theme-init/feed)WikiDiscussions main Synced 3w ago

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

wp-theme-init
=============

[](#wp-theme-init)

#### Version: 2.19.1

[](#version-2191)

A common baseline of repeated functions, filters and actions used across our WordPress themes. This may not be much use if you're not working at [Ideas On Purpose](https://www.ideasonpurpose.com), but the code is here so the solutions themselves can be shared.

[![Packagist](https://camo.githubusercontent.com/1ba451345653c7305e5aea4a1b9470967e167aa59fc1f450e19b314a43b09e5a/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f69646561736f6e707572706f73652f77702d7468656d652d696e6974)](https://packagist.org/packages/ideasonpurpose/wp-theme-init)[![codecov](https://camo.githubusercontent.com/c8d0763e7c6404c08a7c2eee16bdb407274cee15355c4618e8100ca7dbe66a79/68747470733a2f2f636f6465636f762e696f2f67682f69646561736f6e707572706f73652f77702d7468656d652d696e69742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ideasonpurpose/wp-theme-init)[![Coverage Status](https://camo.githubusercontent.com/c3c0f4b3f182fb61efd6ef7d53c4d6d4a719d0abaf36ebd2c0ad663b4a66d4f1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f69646561736f6e707572706f73652f77702d7468656d652d696e69742f62616467652e737667)](https://coveralls.io/github/ideasonpurpose/wp-theme-init)[![Maintainability](https://camo.githubusercontent.com/7ee1c469d998a2a4aa121c0957ec9c8ed64f8af1896bd2d1efe9ef80e313ecfe/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33386131343530336164643238303661393962642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/ideasonpurpose/wp-theme-init/maintainability)[![styled with prettier](https://camo.githubusercontent.com/7c31269a4fab27bd4b327813e7a459cf7a76da0b0b009254bf949a20889d2b6c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c65645f776974682d70726574746965722d6666363962342e737667)](https://github.com/prettier/prettier)

### Some of what's included:

[](#some-of-whats-included)

- **Webpack dependency manifest asset loading**
    Uses the [Dependency Manifest Plugin](https://github.com/ideasonpurpose/docker-build/blob/master/lib/DependencyManifestPlugin.js) from [ideasonpurpose/docker-build](https://github.com/ideasonpurpose/docker-build).

    Scripts will be enqueued using the stylesheet "slug" combined with their entrypoint name.

    For example, if the theme directory was `ldco`, the following manifest entry would be enqueued as `ldco-main`

    ```
    {
      "main": {
        "files": {
          "main.js": "/wp-content/themes/ldco/dist/main-b4216f6b.js"
        }
      }
    }
    ```

    Editor assets are enqueued using the [appropriate hooks](https://developer.wordpress.org/block-editor/how-to-guides/enqueueing-assets-in-the-editor/#editor-content-scripts-and-styles); [`enqueue_block_editor_assets`](https://developer.wordpress.org/reference/hooks/enqueue_block_editor_assets/) for scripts and [`enqueue_block_assets`](https://developer.wordpress.org/reference/hooks/enqueue_block_assets/) for styles.

    - All scripts are enqueued as ESM by adding the `type="module"` to included script tags.
    - Assets are enqueued with priority **500**.
    - Handles are the theme-name and the entrypoint. For the **iop-client** theme, the **main** stylesheet would be enqueued as `iop-client-main`.
- **Miscellaneous Fixes and Cleanup**

    - Add an i18n-ready design credit to the WordPress dashboard.
    - "Howdy" is removed from the admin menu bar.
    - IOP's i18n library
    - Lots of junk is removed from wp\_head. Many optimizations originally came from Roots.io's retired [Soil plugin](https://roots.io/plugins/soil/).
    - WordPress will attempt to trigger a webpack devServer reload from the `save_post` hook.
    - Override the [`DISALLOW_FILE_EDIT`](https://developer.wordpress.org/apis/wp-config-php/#disable-the-plugin-and-theme-file-editor) constant and block access to the [Theme File Editor](https://wordpress.org/documentation/article/appearance-theme-file-editor-screen/).
- **Block Editor**
    Disable [third-party block suggestions](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#block-directory) and [ remote block patterns](https://developer.wordpress.org/block-editor/reference-guides/filters/editor-filters/#block-patterns).
- **ShowIncludes**
    A div showing all included theme files will be appended to the page when `WP_DEBUG` is true. To disable it, initialize the class with an array containing: `['showIncludes' => false]`
- **Template Audit**
    Adds a Template column to Pages admin and a summary table to the Appearance menu showing which templates have been assigned to pages.
- **Record Users' Last Login time**Users' last successful logins are recorded and added to the WordPress Admin User table.
- **Reset Metabox Order &amp; Visibility**Adds buttons to the bottom of user profiles which will reset all metabox order and visibility from user\_meta.
- **Enable and limit WP\_POST\_REVISIONS**Revisions are set to 6, this overrides any constants set in wp-config.php.
- **Global Comments Disable**Comments and Trackbacks are completely disabled. To re-enable comments, initialize the ThemeInit class with an array containing: `['enableComments' => true]`
- **Remove jQuery Migrate** (optional) Prevent jQuery Migrate from loading by removing it from the list of WordPress dependencies. To remove jquery-migrate, initialize the ThemeInit class with an array containing: `['jQueryMigrate' => false]`
- **Admin Separators**Admin Separators have been moved to their own library: [wp-admin-separators](https://github.com/ideasonpurpose/wp-admin-separators)
- **Remove Stale Login Cookies**Repeatedly spinning up local dev environments often bloats **localhost** cookies with stale `wordpress_logged_in` entries. Once these accumulate, the local server will eventually fail with a bad request and the error message *"Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit."* The cookie can be removed using the browser's dev tools, if the error is recognized -- but it often isn't. Instead, wp-theme-init removes stale login cookies from the `wp_login` hook, preventing the issue. This only runs on development environments when WP\_DEBUG is set.
- **Media**Several media related features will be enabled:

    - The JPEG Compression value can be set by defining a `JPEG_QUALITY` constant before invoking `ThemeInit()`. Numeric values will be clamped between 0-100 then passed to the [WordPress `jpeg_quality` filter](https://developer.wordpress.org/reference/hooks/jpeg_quality/). `JPEG_QUALITY` defaults to `82`.
    - A high-quality Lanczos scaling filter will be used for scaling images.
    - All image uploads will be re-compressed if their filesize can be reduced by at least 75%.
- **Search**A few improvements to native WordPress search

    - Short-circuit search queries &lt;2 characters long
    - Redirect query searches to `/search/`
    - Workaround leading-dot search failures
- **SEO Framework Tweaks**We apply several tweaks to the excellent [The SEO Framework plugin](https://theseoframework.com/):

    - Hide the author's name
    - Move the metabox to the bottom of admin pages
    - Show the default image from the first post in archives
- **Customize the WordPress Login Screen** (wp-login.php)
    Customizes the WordPress login page by adding a client logo, byline, and footer. The logo can be a string or a callable function (e.g., using wp-svg-lib). All arguments are optional, but the first (`$siteLogo`) is required to display a logo.

    Instantiate the class like this:

    ```
    $siteLogo = fn() => $SVG->siteLogo(300, 'auto');
    $byline = 'A WordPress site by Ideas On Purpose';
    $footer = fn() => sprintf(
        '%s',
        $SVG->siteLogo(32, 'auto')
    );

    new ThemeInit\Admin\CustomLoginScreen($siteLogo, $byline, $footer);

    // or with just the logo
    new ThemeInit\Admin\CustomLoginScreen($siteLogo);

    // or with no arguments (no logo will be shown)
    new ThemeInit\Admin\CustomLoginScreen();
    ```

Logo colors, margins and maximum size can be customized by setting any of these CSS properties in the **admin.css** scope:

```
:root {
  --iop-login-logo-color: seagreen;
  --iop-login-footer-logo-color: slategray;
  --iop-login-footer-logo-hover: steelblue;

  --iop-login-logo-margin-top: 0;
  --iop-login-logo-margin-left: 10px;
  --iop-login-logo-margin-bottom: 0;
  --iop-login-logo-margin-right: 0;

  --iop-login-logo-max-width: 270px;
  --iop-login-logo-max-height: 125px;
}
```

Note that the **theme.json** `--wp--preset--` properties are not defined for the login page, so any values from that file will need to be manually duplicated.

WordPress Integration
---------------------

[](#wordpress-integration)

Dependency manifest processing is designed to work with the WordPress [Dependency Extraction Webpack Plugin](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dependency-extraction-webpack-plugin/). This omits a subset of script libraries included with WordPress, and outputs a PHP snippet for each entry point which includes a dependency list for enqueuing scripts.

The set of WordPress scripts which will be omitted is listed [here](https://github.com/WordPress/gutenberg/tree/trunk/packages/dependency-extraction-webpack-plugin#webpack) and includes `jquery`, `lodash`, `moment`, `react` and `react-dom` as well as all scripts from the `@wordpress` namespace.

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

[](#development)

Run the PHPUnit test suite with: `npm run test`.

To work on this project while installed in another project, add `repositories` to your **composer.json** file, then work on the checked-out repository in vendors.

```
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/ideasonpurpose/wp-theme-init"
    }
  ]
```

-

[](#)

#### Brought to you by IOP

[](#brought-to-you-by-iop)

[![IOP Logo](https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/iop-logo-white-on-black-88px.png)](https://www.ideasonpurpose.com)[![](https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/spacer.png)](https://raw.githubusercontent.com/ideasonpurpose/ideasonpurpose/master/spacer.png) This project is actively developed and used in production at [Ideas On Purpose](https://www.ideasonpurpose.com).

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance86

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity77

Established project with proven stability

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 ~50 days

Total

59

Last Release

31d ago

Major Versions

v1.7.1 → v2.0.22020-05-11

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8320?v=4)[Joe Maller](/maintainers/joemaller)[@joemaller](https://github.com/joemaller)

---

Tags

pluginwordpressinitIdeas On Purpose

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ideasonpurpose-wp-theme-init/health.svg)

```
[![Health](https://phpackages.com/badges/ideasonpurpose-wp-theme-init/health.svg)](https://phpackages.com/packages/ideasonpurpose-wp-theme-init)
```

###  Alternatives

[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.7k](/packages/afragen-git-updater)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13465.7k](/packages/webdevstudios-cmb2-attached-posts)[iceicetimmy/acf-post-type-selector

Post type selector for Advanced Custom Fields.

559.0k](/packages/iceicetimmy-acf-post-type-selector)

PHPackages © 2026

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