Support » Plugin: Carbon Fields » Error When Including Carbon Fields in Plugin

  • Resolved uamv

    (@uamv)


    I have successfully included Carbon Fields in a plugin I am developing for release to the WP plugin directory. (Thanks to @atanasangelovdev for the help here.)

    However, now as I am attempting to the upload my plugin zip file for review, I receive the following error:

    Error: The plugin already exists. There is already a plugin called carbon-fields by a different author. Please change the Plugin Name: line in your main plugin file and upload it again.

    It appears that @meshsmith encountered a similar issue here.

    At the moment, is my best course of action to remove the headers from my-plugin-dir/wp-content/plugins/carbon-fields/carbon-fields-plugin.php? Or, is there a better way to approach inclusion of this framework in my plugin? Thanks for any advice you can offer.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Atanas Angelov

    (@atanasangelovdev)

    Hi @uamv,

    For the time being, manually removing the headers is the best solution.

    We are currently looking at different solutions to find a better one and hopefully we will have it ready for the next minor release.

    FYI, you can add this to your composer.json so no duplicate wp-content/plugins directories are created inside your plugin directory:

    
    "extra": {
        "installer-paths": {
            "vendor/{$vendor}/{$name}/": ["type:wordpress-plugin"]
        }
    }
    
    uamv

    (@uamv)

    Thanks! Manually removing the header worked for me. Also, thanks for the tip on preventing the duplicate wp-content directory.

    uamv

    (@uamv)

    FYI, for others who might stumble upon this. I also reached out to Daniel Hendricks after having read his brief writeup on Carbon Fields. He suggested the following, which also worked.

    I would probably try having it delete the carbon-fields-plugin.php file when it pulls. I don’t think you need it if you’re autoloading via PSR-4.

    "scripts": {
        "pre-autoload-dump": [
            "rm ./vendor/htmlburger/carbon-fields/carbon-fields-plugin.php"
        ]
    }

    This, of course, prevents the need to manually remove the header after any future updates.

    Plugin Contributor Atanas Angelov

    (@atanasangelovdev)

    Updating this ticket since we just released 2.0.2 which resolves the issue with the headers – https://github.com/htmlburger/carbon-fields/releases/tag/2.0.2

    The plugin loader file is now it’s own separate package so requiring htmlburger/carbon-fields won’t cause issues like this anymore.
    This also means you do not need the scripts and extra declarations when including Carbon Fields in your plugin or theme.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error When Including Carbon Fields in Plugin’ is closed to new replies.