0

I am currently creating an administrator plugin to manage and edit a large amount of separate information about establishments. I recreated a page with the list of articles which is linked to a new table in the database. Now I want to create a fully custom page of the same type as post-new.php - without the left menu and the top wordpress menu bar.

add_submenu_page( 'a-list', 'Add ', 'Add','manage_options', 'asso-add','atv_a_add');
function atv_a_add(){
      include plugin_dir_path( __FILE__ ) . 'adminpages/a-asso.php';
}

I have read in other post that post-new.php is not intended to be customized. How can I create a page that looks like post-new.php without the styling and access it from add_submenu_page ()?

For now the sub_menu_page redirects to wp-admin/admin.php?page=add. My page should link to wp-admin/custom-new.php or https://www.website.com/custom-new.php. But I wouldn't want to lose wordpress's default security.

5
  • "My page should link to wp-admin/custom-new.php or website.com/custom-new.php." I don't have a solution for your question at hand, but I can say for sure that this particular request is not going to be possible. Sep 6 at 12:54
  • would it then be possible to change the appearance of the custom meta boxes in post-new.php? ie style, position and add functionality? Sep 6 at 13:16
  • Loading a PHP file directly in a theme or plugin is very bad practice and has major security risks. What you're asking for is a very dangerous solution too a problem that has other safer/easier solutions. Have you considered asking how to hide the main menu and the nav bar? The block editor does this by default, and it's not difficult to do (unlike what you're asking which is guaranteed to have major security and plugin compatibility issues)
    – Tom J Nowell
    Sep 6 at 14:20
  • Likewise if you want a post editor to appear on the frontend, a custom post-new.php file is a worst case scenario implementation for that too. Anything involving a custom fiie or moving modifying those files will be catastrophic for security.
    – Tom J Nowell
    Sep 6 at 14:21
  • Tom J Nowell. I am aware that it is important not to change the default settings of wordpress and its editing files for obvious security reasons. However I would like to find a solution to customize gutenberg editor by inserting metaboxes and text boxes where I want with a personalized style. The latest version talks about the theme.json intended for developers, but it doesn't make any reference to the backend / administrator part for plugin development. My current question is only on the backend part. I would inquire afterwards for the editing of articles from the frontend. Sep 7 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.