Skip to content

Instantly share code, notes, and snippets.

View adamcrampton's full-sized avatar
💪
Crushing it

Adam Crampton adamcrampton

💪
Crushing it
  • Sydney, Australia
View GitHub Profile
@adamcrampton
adamcrampton / acf_fields_post_table.md
Last active July 2, 2019 22:49 — forked from PurpleBooth/README-Template.md
ACF field values for WordPress wp_posts table

Manual Insertion of ACF Fields Into The WordPress Database

To add ACF fields to the WordPress database (e.g. when using a seeder), you need to add each ACF field as a row into the wp_posts table using the post_type value of acf-field.

This guide assumes that you have defined the fields with PHP and are seeding posts directly into the WordPress database.

Note: You can also create ACF Groups in a similar way using acf-field-group post_type. I will cover this in a separate gist.

Getting Started

Note: The only practical use case for this is a database seeder (e.g. for demo data) - any other interaction with ACF and the WordPress database should really be done via the plugin itself.

@adamcrampton
adamcrampton / dd.php
Created April 9, 2019 01:20 — forked from james2doyle/dd.php
A implementation of "dump and die" (dd) for WordPress
<?php
if (!function_exists('dd')) {
function dd($data)
{
ini_set("highlight.comment", "#969896; font-style: italic");
ini_set("highlight.default", "#FFFFFF");
ini_set("highlight.html", "#D16568");
ini_set("highlight.keyword", "#7FA3BC; font-weight: bold");
ini_set("highlight.string", "#F2C47E");