How to use shortcodes in admin backend
-
Hi all,
I am currently trying to figure out a solution to this:
I have made a link to a custom page in the admin backend. What i want is that whenever that page content is parsed the shortcode will be parsed also.
For example, the page has [form id=1] and when i load it as a regular user it shows the actual form, but when i call that page in admin backend it shows the shortcode not the form.
Here is the code i use to create a page menu item on the dashboard
function mt_add_pages() { // Add a new top-level menu: // The first parameter is the Page name(Site Help), second is the Menu name(Help) //and the number(5) is the user level that gets access add_menu_page('Tenant Report It', 'Tenant Report It', 5, __FILE__, 'mt_toplevel_page'); } // mt_toplevel_page() displays the page content for the custom Test Toplevel menu function mt_toplevel_page() { $page_id = 119; $page_data = get_page( $page_id ); $content = apply_filters('the_content', $page_data->post_content); //echo $content; echo do_shortcode($content); } // Insert the mt_add_pages() sink into the plugin hook list for 'admin_menu' add_action('admin_menu', 'mt_add_pages');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to use shortcodes in admin backend’ is closed to new replies.