Make WordPress Core

Ticket #16946: my_bug.php

File my_bug.php, 1011 bytes (added by momo360modena, 15 years ago)

Proof of bug

Line 
1<?php
2/*
3Plugin Name: Explain my bug
4Plugin URI: http://wordpress.org
5Description: Bug proof.
6Author: Amaury Balmer
7Version: 0
8Author URI: http://beapi.fr
9*/
10
11// 1. Register a custom post type
12add_action('init', 'register_my_cpt');
13function register_my_cpt() {
14 register_post_type( 'test', array(
15 'public' => true,
16 'capability_type' => 'post',
17 'map_meta_cap' => true,
18 'hierarchical' => false,
19 'rewrite' => false,
20 'query_var' => false,
21 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
22 'menu_position' => 25 // Bug with the value 25 and 26
23 ) );
24}
25
26// 2. Add menu with the function add_object_page()
27add_action('admin_menu', 'update_menu_admin');
28function update_menu_admin() {
29 add_object_page('My Menu', 'My Menu', 'manage_options', 'my-menu', 'my_page');
30}
31function my_page() {
32 echo 'Hello world';
33}
34
35// 3. See the menu, you will see that the post type test is overwrite by the custom menu.
36?>