WordPress custom plugin developement

Use add_submenu_page and set $parent_slug to null: add_action(‘admin_menu’, ‘wpdocs_register_my_custom_submenu_page’); function wpdocs_register_my_custom_submenu_page() { add_submenu_page( null, ‘My Custom Submenu Page’, ‘My Custom Submenu Page’, ‘manage_options’, ‘my-custom-submenu-page’, ‘my_custom_submenu_page_callback’, ); }

Deactivate Other Incompatible Plugin Upon Activation

Ok, based on the comments, I decided to just prevent activation and send an admin notice instead. add_action( ‘admin_notices’, ‘lsmi_admin_notice’ ); add_action( ‘network_admin_notices’, ‘lsmi_admin_notice’ ); function lsmi_admin_notice() { if( class_exists ( ‘Location_Specific_Menu_Items_By_City’ ) ){ global $pagenow; if( $pagenow == ‘plugins.php’ ){ deactivate_plugins ( ‘lsmi-by-country/LSMI_Country.php’ ); if ( current_user_can( ‘install_plugins’ ) ) { echo ‘<div id=”error” … Read more

Developing a plugin where users can edit entries saved in database

I’ve managed to do it, but probably there is a much cleaner WP way of doing these things. So, I have a menu page that I’ve added using add_menu_page. On it, I display all the records. The url is: /wp-admin/admin.php?page=plugin-settings (or whatever you call it) I use: <a href=”https://wordpress.stackexchange.com/questions/218076/<?php echo bloginfo(“url’);?>/wp-admin/admin.php?page=utm-user-plugin-settings&id=<?php echo $row->id; ?>”>Edit</a> So … Read more

wp_query (or hook) posts by date (id) in array then set post_type

Thank to @pietergoosen for “jokingly” giving me the answer. function gm_gather_posts_in_array() { $set_days_before=”1275″; $posts_to_be_processed = date(‘Y-m-d’, strtotime(“today – $set_days_before days”)); $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘date_query’ => array( array( ‘before’ => $posts_to_be_processed ) ) ); $posts_to_be_processed = new WP_Query( … Read more