2.0 Compatibility

Groundhogg 2.0 will be a massive leap forward for Groundhogg as we future proof our tools to stand the test of time, WordPress updates, Php version changes and plugin incompatibilities.

Our goals for 2.0:

  • Introduce Namespacing
    This would aid in the avoidance of possible plugin conflicts as well as provide a superior architecture for development in the future.
  • Autoloading
    2.0 introduces class autoloading for superior performance and load speeds.
  • Managed Compliance and Pages
    In 1.+ the burden of ensuring pages, links and certain settings were properly set, but 2.0 introduces the managed compliance center which will remove several steps and settings for the end-user to worry about.
  • Abstraction and Extension
    2.0 Introduces several abstract and template classes that can be used to build WordPress admin UI quickly and efficiently with minimal code. Allowing plugin developers to build their add-ons with pre-built libraries instead of from scratch.
  • Code Organization
    We’ve re-organized much of the plugin files and folders so that they are more clear as to their purpose and location.
  • Utilize the WPRewrite API
    In 1.3 we essentially perform most actions utilizing query vars in the URL. 2.0 makes extensive use of the WP Rewrite API to provide better performance and minimize compatibility issues.

What do I need to do?

If you have a custom integration built, then you may need to update your code to be compatible with 2.0, as much has changed.

The first thing you should do is download a copy of version 2.0 and test if it breaks anything.

Code examples:

Adding a Contact:


// New Contact Args
$args = [
 'first_name' => 'John',
 'last_name' => 'Doe',
 'email' => 'johndoe@gmail.com',

### 2.0 ###
// Initialize a new Contact object with the given contact args and if the
// contact does not exist it will simply add it to the DB automatically

$contact = new \Groundhogg\Contact( $args );
if ( $contact->exists() ){
   echo 'Contact added!';

### 1.3 ###
// We have to query the DB first and retreive the contact id
// Once we've checked we have the contact id we can the generate a contact object

$contact_id = WPGH()->contacts->add( $args );
if ( $contact_id ){
    $contact = new WPGH_Contact( $contact_id );

Adding a Tag:


// 2.0
$contact_id = 123;
$tag_id = 321;

$contact = new \Groundhogg\Contact( $contact_id );
$contact->add_tag( $tag_id ) 

// 1.3
$contact = new WPGH_Contact( $contact_id );
$contact->add_tag( $tag_id )

Was this article helpful to you? Yes No

How can we help?