Skip to content

Commit f059631

Browse files
committed
#99 - Force menu slug for ACF
1 parent 276bbd6 commit f059631

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

inc/services/acf.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public function init() {
9494
*
9595
* $this->acf_add_options_page( [
9696
* 'page_title' => __( 'Theme Options', 'framework-textdomain' ),
97+
* 'menu_slug' => 'theme-options',
9798
* 'parent_slug' => 'themes.php',
9899
* ] );
99100
*
@@ -147,18 +148,21 @@ public function get_files() {
147148
}
148149

149150
/**
151+
* Add options Subpage
152+
*
150153
* @param $parameters
151154
*
152155
* @return bool
153156
*/
154157
public function acf_add_options_sub_page( $parameters ) {
155-
/**
156-
* Add Option Subpage
157-
*/
158158
if ( ! function_exists( 'acf_add_options_sub_page' ) ) {
159159
return false;
160160
}
161161

162+
if ( ! isset( $parameters['menu_slug'] ) ) {
163+
throw new Exception( 'You must specify menu slug for ACF options page.' );
164+
}
165+
162166
return acf_add_options_sub_page( $parameters );
163167
}
164-
}
168+
}

0 commit comments

Comments
 (0)