PHPackages                             mituu/acf-default-value-initializer - 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. mituu/acf-default-value-initializer

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

mituu/acf-default-value-initializer
===================================

ACF plugin to automatically initialize default values for existing posts and users

1.0.0(1y ago)17GPL-2.0-or-laterPHPPHP &gt;=8.1

Since May 25Pushed 1y agoCompare

[ Source](https://github.com/mituu-rs/acf-default-value-initializer)[ Packagist](https://packagist.org/packages/mituu/acf-default-value-initializer)[ RSS](/packages/mituu-acf-default-value-initializer/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ACF Default Value Initializer
=============================

[](#acf-default-value-initializer)

[![Latest Stable Version](https://camo.githubusercontent.com/b621b080d82745ed88bbdba223f86ba37e6d418e7d399a889a328e025558a441/68747470733a2f2f706f7365722e707567782e6f72672f6d697475752f6163662d64656661756c742d76616c75652d696e697469616c697a65722f762f737461626c65)](https://packagist.org/packages/mituu/acf-default-value-initializer)[![Total Downloads](https://camo.githubusercontent.com/c49ae0c482136115f3b0c7c75af4034b51ba08f88c3853227a6538dc72e37a32/68747470733a2f2f706f7365722e707567782e6f72672f6d697475752f6163662d64656661756c742d76616c75652d696e697469616c697a65722f646f776e6c6f616473)](https://packagist.org/packages/mituu/acf-default-value-initializer)[![License](https://camo.githubusercontent.com/95bf6b72bfb1e0344160f436380919caa75ccd7f7c940bb300105eed1e4ec6ed/68747470733a2f2f706f7365722e707567782e6f72672f6d697475752f6163662d64656661756c742d76616c75652d696e697469616c697a65722f6c6963656e7365)](https://packagist.org/packages/mituu/acf-default-value-initializer)[![PHP Version Require](https://camo.githubusercontent.com/ed4f62969d6f86f7b4cfc0af0a80e1c920ad5a63f5dfabf4a1d3ab5f8f22c899/68747470733a2f2f706f7365722e707567782e6f72672f6d697475752f6163662d64656661756c742d76616c75652d696e697469616c697a65722f726571756972652f706870)](https://packagist.org/packages/mituu/acf-default-value-initializer)[![Monthly Downloads](https://camo.githubusercontent.com/600c61dff62de8a0a13e78eab712d8184f48c4d9aa71bea7f1f981a865e2adae/68747470733a2f2f706f7365722e707567782e6f72672f6d697475752f6163662d64656661756c742d76616c75652d696e697469616c697a65722f642f6d6f6e74686c79)](https://packagist.org/packages/mituu/acf-default-value-initializer)

A WordPress plugin that automatically initializes default values for Advanced Custom Fields (ACF) on existing posts and users.

Description
-----------

[](#description)

When you add new ACF fields with default values to existing content, WordPress typically only applies these defaults to new posts/users created after the field was added. This plugin solves that problem by automatically applying default values to existing content that doesn't have a value for the field.

Features
--------

[](#features)

- 🔄 **Automatic Default Value Application**: Applies default values to existing posts/users when fields are saved
- ⚙️ **Field-Level Control**: Enable/disable default value initialization per field
- 🎯 **Selective Processing**: Only processes content that doesn't already have a value for the field
- 🔧 **Manual Processing**: Admin interface button for manual initialization
- 📝 **Multiple Post Types**: Works with posts, pages, custom post types, and users
- 🛡️ **Safe Processing**: Only updates empty fields, preserves existing data
- 🎨 **Clean Admin UI**: Seamless integration with ACF field settings

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

[](#requirements)

- **WordPress**: 6.4 or higher
- **PHP**: 8.1 or higher
- **ACF**: Advanced Custom Fields (free or Pro version)

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require mituu/acf-default-value-initializer
```

### Manual Installation

[](#manual-installation)

1. Download the plugin
2. Upload to `/wp-content/plugins/acf-default-value-initializer/`
3. Activate through the WordPress admin

### Enabling Default Value Initialization

[](#enabling-default-value-initialization)

1. Go to **Custom Fields &gt; Field Groups** in your WordPress admin
2. Edit any field group
3. For each field you want to initialize defaults:
    - Open the field settings
    - Enable the **"Initialize Default Values"** checkbox
    - Set your desired default value for the field
4. Save the field group

### Supported Field Types

[](#supported-field-types)

The plugin supports default value initialization for:

- Text, Textarea, Number, Email, URL, Password
- Select, Checkbox, Radio, Button Group, True/False
- Date Picker, Date Time Picker, Time Picker, Color Picker
- Range, WYSIWYG, oEmbed
- User, Post Object, Page Link, Relationship, Taxonomy
- Image, File, Gallery

### Manual Processing

[](#manual-processing)

If you need to manually trigger default value initialization:

1. Edit a field group in the ACF admin
2. Look for the **"🔄 Initialize Default Values"** button
3. Click the button to manually process all existing content for this field group

How It Works
------------

[](#how-it-works)

### Automatic Processing

[](#automatic-processing)

When you save a field group with fields that have "Initialize Default Values" enabled:

1. The plugin identifies all posts/users that match the field group's location rules
2. For each field with initialization enabled, it checks if the post/user has a value
3. If no value exists, it applies the field's default value
4. Existing values are never overwritten

### Processing Flow

[](#processing-flow)

```
Field Group Save → Check Enabled Fields → Find Target Content → Apply Defaults

```

Technical Details
-----------------

[](#technical-details)

### Plugin Structure

[](#plugin-structure)

```
acf-default-value-initializer/
├── acf-default-value-initializer.php  # Main plugin file
├── composer.json                      # Composer configuration
├── assets/js/                         # JavaScript files
│   └── field-settings.js             # Admin UI enhancements
└── src/                              # PHP classes
    ├── Plugin.php                    # Main plugin class
    ├── Hooks.php                     # WordPress hooks
    ├── FieldSettings.php             # ACF field settings
    └── DefaultValueProcessor.php     # Core processing logic

```

### Key Classes

[](#key-classes)

- **`Plugin`**: Main plugin initialization and coordination
- **`Hooks`**: WordPress action/filter hooks management
- **`FieldSettings`**: ACF field settings modifications
- **`DefaultValueProcessor`**: Core logic for applying default values

### Hooks and Filters

[](#hooks-and-filters)

The plugin uses these WordPress hooks:

- `acf/save_post` - Triggers default value processing
- `acf/render_field_settings` - Adds the initialization checkbox
- `wp_ajax_acf_dvi_process_field_group` - Handles manual processing

Configuration
-------------

[](#configuration)

### Field-Level Settings

[](#field-level-settings)

Each ACF field can be individually configured:

```
// Field setting added by the plugin
'init_default_values' => 1  // Enable default value initialization
```

### Location Rules

[](#location-rules)

The plugin respects ACF location rules, so default values are only applied to content that matches the field group's location conditions.

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

[](#development)

### Local Development Setup

[](#local-development-setup)

```
# Clone the repository
git clone https://github.com/mituu-rs/acf-default-value-initializer.git

# Install dependencies (if using Composer)
composer install
```

### Code Standards

[](#code-standards)

- PHP 8.1+ with strict types
- PSR-4 autoloading
- WordPress coding standards
- Comprehensive error handling

Changelog
---------

[](#changelog)

### Version 1.0.0

[](#version-100)

- Initial release
- Automatic default value initialization
- Field-level control settings
- Manual processing interface
- Support for all major ACF field types

Support
-------

[](#support)

For issues, feature requests, or contributions:

- **Repository**: [GitHub](https://github.com/mituu-rs/acf-default-value-initializer)
- **Author**: [mituu](https://mituu.dev)

License
-------

[](#license)

This project is licensed under the GPL v2 or later - see the [LICENSE](https://www.gnu.org/licenses/gpl-2.0.html) for details.

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance46

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

404d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e7acb96d757bc0923913bd28f2aefea62c0e0dfd69a6534feda3c3ac45ef998?d=identicon)[mituu](/maintainers/mituu)

---

Top Contributors

[![mituu-rs](https://avatars.githubusercontent.com/u/137115338?v=4)](https://github.com/mituu-rs "mituu-rs (3 commits)")

### Embed Badge

![Health badge](/badges/mituu-acf-default-value-initializer/health.svg)

```
[![Health](https://phpackages.com/badges/mituu-acf-default-value-initializer/health.svg)](https://phpackages.com/packages/mituu-acf-default-value-initializer)
```

###  Alternatives

[workerman/stomp

1010.7k6](/packages/workerman-stomp)

PHPackages © 2026

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