I *think* setting the CPT to public
in the register_post_type args should result in the CPT being available harrycustom.
hope this helps,
frank
Just a heads up, I have 'public' => true, in my register_post_type( 'mycustompost', $args ); but still no ao_metabox on mycustompost, Maybe the critical css condition though is totally different.
-
This reply was modified 3 years, 7 months ago by
drazon. Reason: explanation
just checked…I confirm, setting public to false hides the custom post type from the critical css but if set to true then it is shown.
Thanks for the filter Frank I will use it.
Ok, perfect, thank you so much!
I am sorry I’ve checked today but public is set as true, but I cannot see my CPT. π
I have two custom post types on my site, in which I want to display the AO options:
I have written this small function:
function ao_add_metabox_lifterlms( $screens ) {
$screens = [ 'course', 'llms_membership' ] ;
return $screens;
}
add_filter( 'autoptimize_filter_metabox_screens', 'ao_add_metabox_lifterlms' );
It works but could you Frank confirm it is the proper way of doing this?
I think you would override the default “screens” that way (for post & page), so I would rather do something like this;
function ao_add_metabox_lifterlms( $screens ) {
$screens[] = 'course';
$screens[] = 'llms_membership';
return $screens;
}
add_filter( 'autoptimize_filter_metabox_screens', 'ao_add_metabox_lifterlms' );
hope this helps,
frank
Good point, it did override. I didn’t check post&pages edit screens after applying my code. Your code works like it should.
Thank you