All Collections
Features
Preview and Test Code
Preview and Test Code

Version 2.5 of CodeWP's Platform introduces AI Testing and Manual Preview features for files.

Updated over a week ago

Manually Preview Code

Previewing AI-generated code in CodeWP is straightforward.

You can manually review the functionality added by the code, check for errors, and more using the preview mode.

First, generate AI code or open an existing file to paste in external code.

Then, toggle "Preview" on in the upper right corner of the file editor.

The file editor will be replaced by a fully functional instance of the latest WordPress version with your code snippet automatically installed. You can explore WordPress to see how the snippet interacts with it.

Easily toggle preview mode off to edit the code if needed.

Privacy & Storage

You can learn more about how the preview works by reviewing the WordPress Playground documentation. We're running a customized version of this, integrated directly into the CodeWP Platform. You can also explore the environment at play.codewp.ai.

This preview runs entirely in your browser, and is completely destroyed after you toggle the preview off / refresh your page. This means that you can install pro plugins, and even import an entire copy of your production website in complete isolation, test your code snippet, and remove all traces of any data afterwards.

No data is sent to a server as everything runs directly in the browser. No data is sent from this preview to CodeWP's Platform unless you run an AI Test (more info below).

How Previewing Works with Modes

The Manual Preview will automatically install any WordPress plugins associated with a code snippet, as long as the plugins are available in the WordPress repository. For example, if you create a WooCommerce snippet, the Preview will automatically install WooCommerce for testing purposes.

Pro plugins will not be installed automatically. For accurate testing of snippets extending pro plugins, you will need to install the pro versions yourself.

For example, the Gravity Forms Preview will work with the free Gravity Forms plugin installed, but any pro features will require installing your own copy of the pro version of Gravity Forms.

Similarly, the Preview will install the free version of Advanced Custom Fields (ACF). This may be sufficient for testing modifications or additions to form fields. However, testing ACF pro features like Options Pages will require you to install your own copy of the ACF pro plugin.

Test Code Automatically with AI

The Manual Preview infrastructure is utilized for testing. When you run a Test, it will automatically generate a WordPress Preview in the background, install and execute your File, and detect any major errors resulting from this process.

If errors occur, CodeWP's AI will automatically analyze the code, identify the source of the error, and recommend a solution. You can conversationally accept this proposed solution, prompting CodeWP to edit the file accordingly.

You can easily leverage this capability to evaluate if code is safe to install on a Staging website for additional testing before deployment to production.

This feature will transmit data back to CodeWP. When a Test begins, any Debug Log information from WordPress will be sent to CodeWP for analysis.

You can examine how this mechanism functions by auditing the code for our GPLv3 Licensed Helper Plugin here (most recent version), or on the WordPress Repository.

How Testing Works with Modes

Similarly to the Manual Preview, the Test will not be completely accurate if we cannot install a plugin.

Therefore, AI Testing is disabled for modes that require Pro plugins to function. We're working on a way to address this in the future.

No Package Support Yet

A cornerstone feature of CodeWP is support for multi file packages, which can easily be exported as WordPress plugins or themes. We currently don't support previewing or testing these packages. These features won't show for packages with multiple files.

You can opt into Public Beta testing via your account dashboard to be the first to use these features with packages.

Did this answer your question?