PHPackages                             morningtrain/wp-acf-helper - 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. morningtrain/wp-acf-helper

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

morningtrain/wp-acf-helper
==========================

ACF helpers to WordPress

v0.2.1(3y ago)320.0k↓21.7%MITPHP

Since Jan 10Pushed 3y ago3 watchersCompare

[ Source](https://github.com/Morning-Train/wp-acf-helper)[ Packagist](https://packagist.org/packages/morningtrain/wp-acf-helper)[ RSS](/packages/morningtrain-wp-acf-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Morningtrain\\WP\\ACFHelper
===========================

[](#morningtrainwpacfhelper)

Some helpers to standialize Advanced Custom Fields (ACF) use in our projects.

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Getting Started](#getting-started)
    - [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

This package is made to standialize the way we are using Advanced Custom Fields (ACF) in our projects.

It makes it easy to handle ACF JSON files, hide ACF administration area and check if ACF is not installed or activated on the site.

Getting Started
---------------

[](#getting-started)

To get started install the package as described below in [Installation](#installation).

To use the package have a look at [Usage](#usage)

### Installation

[](#installation)

Install with composer.

`composer require morningtrain/wp-acf-helper`

Usage
-----

[](#usage)

### Add JSON folder

[](#add-json-folder)

To add a foldere where ACF should look for JSON field groups

```
// Add folder to look for JSON files in ./resources/acf-fields
\Morningtrain\WP\ACFHelper\ACFHelper::registerJsonFolder(__DIR__ . '/resources/acf-fields');
```

#### Use JSON folder as save folder

[](#use-json-folder-as-save-folder)

To use the added JSON folder as the folder where ACF use the `useAsSaveFolder` method on the returned `JsonPath` object. You can optionally set a namespace, which is used to force saving in specific folder if more than one project sets a save folder.

*OBS: ACF will not create the folder, so it shall exist before ACF saves in the folder.*

```
// Add folder to look for JSON files in ./resources/acf-fields and use it as save folder
\Morningtrain\WP\ACFHelper\ACFHelper::registerJsonFolder(__DIR__ . '/resources/acf-fields')->useAsSaveFolder('some_namespace');
```

If you will force saving in your folder, define a constant in `wp-config.php` with the namespace set in `useAsSaveFolder`.

```
define('ACF_SAVE_FOLDER', 'some_namespace');
```

### Hide Administration

[](#hide-administration)

To hide aministration from the WP backend.

```
\Morningtrain\WP\ACFHelper\ACFHelper::hideAdmin();
```

This will hide ACF from the WP administration.

#### Hide Administration Except On Specific Environments

[](#hide-administration-except-on-specific-environments)

You can hide admin except on specific environments defined by `WP_ENVIRONMENT_TYPE` in `wp-config.php`.

```
\Morningtrain\WP\ACFHelper\ACFHelper::hideAdminExceptOn([
    'local',
    'development'
]);
```

Possible values are ‘local’, ‘development’, ‘staging’, and ‘production’.

To define the environment add this to *wp-config.php*

```
define('WP_ENVIRONMENT_TYPE', 'local');
```

### Check if ACF is installed and activated

[](#check-if-acf-is-installed-and-activated)

To check if ACF is activated

```
// Abort if ACF is not activated
if(!\Morningtrain\WP\ACFHelper\ACFHelper::isACFActivated()) {
    return;
}
```

Credits
-------

[](#credits)

- [Martin Schadegg Brønniche](https://github.com/mschadegg)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1224d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/278725?v=4)[morningtrain](/maintainers/morningtrain)[@morningtrain](https://github.com/morningtrain)

---

Top Contributors

[![mschadegg](https://avatars.githubusercontent.com/u/11231039?v=4)](https://github.com/mschadegg "mschadegg (17 commits)")

---

Tags

acfphpwordpresswp

### Embed Badge

![Health badge](/badges/morningtrain-wp-acf-helper/health.svg)

```
[![Health](https://phpackages.com/badges/morningtrain-wp-acf-helper/health.svg)](https://phpackages.com/packages/morningtrain-wp-acf-helper)
```

###  Alternatives

[captainhook/plugin-composer

Composer-Plugin handling your git-hooks

201.9M169](/packages/captainhook-plugin-composer)

PHPackages © 2026

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