BoldGrid / boldgrid-inspirations

The BoldGrid Inspirations core plugin for WordPress.
https://www.boldgrid.com/
GNU General Public License v2.0
11 stars 12 forks source link

Create utility method to get page by title #175

Closed jamesros161 closed 1 year ago

jamesros161 commented 1 year ago

This resolves #173

Description

A little background information for this. the WP Core function get_page_by_title() is being deprecated as of 6.2.0 ( see here ) in favor of using WP_Query instead. Prior to WP 6.1 ( see here ), this function already used WP_Query, pretty much in the same manor as used by the method created in this PR. It was changed due to some edge cases where a null value passed to the function would still return a page, and edge cases where the 'orderby' would not have already been set properly. Neither issues impact our usage of this method.

Testing Instructions

The get_page_by_title() method is used by Inspirations before starting the install, and during the post / page deployment part of the installation. This method is used to determine the existence of pre-existing page / post content, and to assist in deleting posts from previous installs.

You can test this by going through the inspirations process in various combinations of the following use cases:

  1. Fresh WP install with no changes / additional content aside from what is created on WP install.
  2. Inspirations install on a site with existing content, but no previous Inspiration theme install.
  3. Inspirations theme install on a site with a pre-existing inspirations install.
  4. Install Inspirations theme w/ Blog
  5. Install Inspirations theme w/o Blog
  6. Install one of the traditional Crio themes.
  7. Install one of the new DreamHost Exclusive themes.