Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
413 stars 56 forks source link

No fields for location : taxonomy == category #138

Closed florent-cdl closed 1 year ago

florent-cdl commented 1 year ago

Hi,

I've created a simple group field for the category taxonomy. Unfortunately nothing appear on the new category screen SCR-20221022-qg0

My field class is however very simple

SCR-20221022-qh0

My configuration : wordpres 6.0.2 / ACF 6.0.3 last version for all modules (fresh install)

A test with : ->setLocation('post_type', '==', 'post'); is ok and field appear on post screen.

Thank you

Log1x commented 1 year ago

I'm not sure what would be causing this but I add fields to the category taxonomy on nearly every site I have and it works as intended with code very similar to yours.

<?php

namespace App\Fields;

use Log1x\AcfComposer\Field;
use StoutLogic\AcfBuilder\FieldsBuilder;

class Category extends Field
{
    /**
     * The field group.
     *
     * @return array
     */
    public function fields()
    {
        $category = new FieldsBuilder('category', ['style' => 'seamless']);

        $category
            ->setLocation('taxonomy', '==', 'category');

        $category
            ->addText('example');

        return $category->build();
    }
}

Screenshot

Log1x commented 1 year ago

Does it show up on the Edit screen?

florent-cdl commented 1 year ago

no, not more in the edit screen. I tested your example but no field appears

florent-cdl commented 1 year ago

it's ok now on a new class. I think the problem comes as I forgotten the first time to run the command "$ wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider" I created my class before that command, so I deleted my class, run the command recreate the class with the same name and ... problem :(

Sorry and thank you so much for your quickly answer.

It's ok now, I will change my class name as it will be problematic Best regards

florent-cdl commented 1 year ago

So it makes me think of one thing : is there a clean process to delete a class field ?

Log1x commented 1 year ago

I just delete the class file (and accompanying view if working with a Block).