Support MB Settings Page Take settings values in add_action( 'init' Reply To: Take settings values in add_action( 'init'

#13855
Anh TranAnh Tran
Keymaster

I got it. Let me summarize the process flow that you're trying to do:

  1. Getting settings
  2. Use the settings to register a CPT
  3. Register custom fields for the CPT

If you don't do the step 3, then you can do both steps 1+2 at priority 30. The CPT will be registered without any problem.

A better solution is getting the settings with get_option, like this:

$option = get_option( 'multi_tema_privado' );
$mb_activacion_articulo = $option['modulo_articulos_activacion'] ?? '';
if ($mb_activacion_articulo == 1) $show_articulo = true;    
$mb_slug_articulo = $option['modulo_articulos_slug'] ?? '';