Skip to content

Hide free levels#422

Open
kimwhite wants to merge 2 commits intostrangerstudios:devfrom
kimwhite:hide-free-levels
Open

Hide free levels#422
kimwhite wants to merge 2 commits intostrangerstudios:devfrom
kimwhite:hide-free-levels

Conversation

@kimwhite
Copy link
Contributor

Created and updated to be used on facelift of this post
https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/

Remove free membership levels from the levels array used by PMPro.

for exsiting post
https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/
These snippets will be added to this post soon.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new code snippet for hiding free membership levels from the Paid Memberships Pro levels page, and updates metadata links in two related files to point to the same blog post. The changes support a blog post facelift at paidmembershipspro.com about hiding free levels.

Changes:

  • Added new snippet to filter out free levels from the levels array using pmpro_isLevelFree()
  • Updated metadata links in two existing level-filtering snippets to point to the same documentation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
frontend-pages/hide-free-levels-from-levels-page.php New snippet that filters free levels from the levels array using pmpro_isLevelFree() function
frontend-pages/hide-levels-from-levels-page-by-id.php Updated metadata to add documentation link
frontend-pages/filter-pmpro-levels-page-levels.php Updated metadata to add documentation link (missing "link:" prefix)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/

function pmpro_snippet_hide_free_levels_from_levels_array( $levels ) {
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name uses the prefix "pmpro_snippet_" which is inconsistent with the naming convention used in the frontend-pages directory. All other files in this directory use the prefix "my_pmpro" or "my_" for their function names (e.g., my_pmpro_levels_array, my_pmpro_member_action_links). Consider renaming to follow the established pattern, such as "my_pmpro_hide_free_levels_from_levels_array".

Copilot uses AI. Check for mistakes.
// Re-index the array (optional, but keeps output tidy).
return array_values( $levels );
}
add_filter( 'pmpro_levels_array', 'pmpro_snippet_hide_free_levels_from_levels_array' ); No newline at end of file
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name in the add_filter call uses "pmpro_snippet_hide_free_levels_from_levels_array" which is inconsistent with the naming convention used in the frontend-pages directory. This should be updated to match the established "my_pmpro" prefix pattern (e.g., "my_pmpro_hide_free_levels_from_levels_array") to maintain consistency with other snippets in this directory.

Copilot uses AI. Check for mistakes.
* layout: snippet
* collection: frontend-pages
* category: levels, level-page
* https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link metadata is missing the required "link:" prefix. The metadata should be formatted as "link: https://..." to be consistent with the established pattern used in other files in the codebase.

Suggested change
* https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/
* link: https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/

Copilot uses AI. Check for mistakes.
*
* title: Hide Free Levels in PMPro Levels Page
* layout: snippet
* collection: membership-levels
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is located in the frontend-pages directory but uses "collection: membership-levels" in its metadata. All other files in the frontend-pages directory use "collection: frontend-pages" as seen in hide-levels-from-levels-page-by-id.php and filter-pmpro-levels-page-levels.php. The collection metadata should match the directory structure to maintain consistency.

Suggested change
* collection: membership-levels
* collection: frontend-pages

Copilot uses AI. Check for mistakes.
* title: Hide Free Levels in PMPro Levels Page
* layout: snippet
* collection: membership-levels
* category: levels
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The category metadata only lists "levels" but similar files in the frontend-pages directory use "levels, level-page" as seen in both hide-levels-from-levels-page-by-id.php and filter-pmpro-levels-page-levels.php. Consider adding "level-page" to maintain consistency with related snippets.

Suggested change
* category: levels
* category: levels, level-page

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant