Skip to content

Commit

Permalink
#99 - Force menu slug for ACF
Browse files Browse the repository at this point in the history
  • Loading branch information
herewithme committed Mar 30, 2020
1 parent 276bbd6 commit f059631
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions inc/services/acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function init() {
*
* $this->acf_add_options_page( [
* 'page_title' => __( 'Theme Options', 'framework-textdomain' ),
* 'menu_slug' => 'theme-options',
* 'parent_slug' => 'themes.php',
* ] );
*
Expand Down Expand Up @@ -147,18 +148,21 @@ public function get_files() {
}

/**
* Add options Subpage
*
* @param $parameters
*
* @return bool
*/
public function acf_add_options_sub_page( $parameters ) {
/**
* Add Option Subpage
*/
if ( ! function_exists( 'acf_add_options_sub_page' ) ) {
return false;
}

if ( ! isset( $parameters['menu_slug'] ) ) {
throw new Exception( 'You must specify menu slug for ACF options page.' );

This comment has been minimized.

Copy link
@Rahe

Rahe Mar 30, 2020

Member
}

return acf_add_options_sub_page( $parameters );
}
}
}

1 comment on commit f059631

@asadowski10
Copy link
Member

Choose a reason for hiding this comment

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

@herewithme rajouter ton throw dans le acf_add_options_page egalement :D

Please sign in to comment.