add_submenu_page returns null

Your code is correct but just you have called wrong capability in add_submenu_page. You just need to replace this ‘manage_options’ instead of ‘manage-options’. And please check it. It’s works. Reference: https://developer.wordpress.org/reference/functions/add_submenu_page/

Getting post attchment URL to populate a CPT Admin Page Column

The File field’s documentation has some options you can try, but here’s an example if your field’s Return Value is array, where you can use $gradingForm[‘url’] to get the attachment URL: $gradingForm = get_field( ‘grading_form’, $post_id ); echo $gradingForm ? ‘<a href=”‘ . esc_url( $gradingForm[‘url’] ) . ‘”>Grading Form</a>’ : ‘N/A’; And the proper way … Read more

Backend Checkboxes working – but not visual?

The answer for me was related to my web servers Content Security Policy. Needed to add “data:” as a possible source default-src data: ‘self’ *.googleapis.com *.gstatic.com; If you are using more specific CSPs like font-src: and img-src: you may also need to allow it within those as well.

Plugin Admin Menu Boiler Plate

This is a great question. I have never seen any kind of framework inside WordPress for building forms, and after a bit of searching now to verify this, I don’t think there is one, although I’m sure others will correct me if there is 😉 So, you probably need to hand code forms as you … Read more

WordPress add page under admin submenu and retaining the active status of the parent submenu page in the menu

If I understand it correctly — you want the “Plans” sub-menu to be highlighted when on the “Add/edit plans” (pxmag-plans-edit) page, then you can do it like so: Use the add_menu_classes hook to highlight the pxmag-menu menu: function my_add_menu_classes( $menu ) { // Do nothing if not on the “Add/edit plans” page. global $plugin_page; if … Read more

Why WP_Screeen doesn’t show all options with admin_body_class

But parent_base is set to null. Yes, because by the time admin_body_class is fired, WordPress hasn’t yet set the parent_base value. And it’s only set after the <body> tag is actually outputted. More specifically, it’s set only after the <div id=”wpbody” role=”main”> as you can see here in wp-admin/admin-header.php. Any idea how to add class … Read more

How to break line / add to ADMIN menu

<br> tags are not the solution to the problem that you were hoping they would be. Menu labels were never intended to contain arbitrary HTML. HTML does slip through in places, but this appears to be a bug and is inconsistent. For Post Types No. You can’t. $menu[ $ptype_menu_position ] = array( esc_attr( $ptype_obj->labels->menu_name ), … Read more

How to align the top of an admin pointer to the target element?

that’s a great question, Alex! Not exactly an answer to the question, but the following will work: jQuery(‘#menu-settings’).first().pointer( { “content”: “<h3>Pointer header<\/h3>” + “<h4>Pointer subheader<\/h4>” + “<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Levatio igitur vitiorum magna fit in iis, qui habent ad virtutem progressionis aliquantum. Rationis enim perfectio est virtus; Sed ego in … Read more

how to save checkbox data for custom setting?

Your checkbox data is saved as 1 or ” if someone checked or unchecked it. you can also verify this using var_dump($checkbox) inside custom_checkbox_field_html function This should work. function custom_checkbox_field_html(){ $checkbox = get_option( ‘disabletitle_text’ ); $is_checked = ( $checkbox != ” && $checkbox == 1 ) ? ‘checked’: ”; printf( ‘<input type=”checkbox” id=”disabletitle_text” name=”disabletitle_text” value=”1″ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)