WordPress parent select need to be removed

Per comments a way around it is to set the post_type to something that isn’t a hierarchical type in the filter, as the wp_dropdown_pages() function used to populate the select calls get_pages() which just returns without doing anything if the post_type isn’t hierarchical. So using a non-existent post_type works: function limit_parents_wpse_106164( $args ) { $args[‘post_type’] … Read more

Can I display the widget admin in the page admin?

If I understand well your want to show the widgets adding and removing interface inside a meta box. An easy, -a little dirty- way is using an iframe: function metaboxed_widgets_admin() { if ( ! current_user_can( ‘edit_theme_options’ ) ) return; add_meta_box(‘metaboxed_widgets’, __(‘Widgets’), ‘metaboxed_widgets_admin_cb’, ‘page’); } add_action( ‘add_meta_boxes’, ‘metaboxed_widgets_admin’ ); function metaboxed_widgets_admin_cb() { if ( ! current_user_can( … Read more

How to embed page content in a blog post

Create a shortcode to embed the content. This will always be synchronized. Sample code from an older project. Just updated. ๐Ÿ™‚ GitHub: https://gist.github.com/3380118 ยท This post in German (auf Deutsch) on my blog. <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Embed Post Shortcode * Description: Embed any page, post or custom … Read more

What is the use of $page_title and how to use it?

Ok my bad found the answer on the codex page but at the very bottom so I’m adding this here as well so if anyone like my didn’t catch it on WordPress’s codex, they can find it here ๐Ÿ™‚ Just use get_admin_page_title(); See the example 1 below: function register_my_custom_submenu_page() { add_submenu_page( ‘tools.php’, ‘My Custom Submenu … Read more

Get page id by title?

There is a function exactly for that: get_page_by_title( $page_title, $output = OBJECT, $post_type=”page” ); You can use it like this: $page = get_page_by_title( ‘Start’ ); To get the page from a specific post type: $custom = get_page_by_title( ‘Start’, OBJECT, ‘your_custom_post_type’ ); $post = get_page_by_title( ‘Start’, OBJECT, ‘post’ ); Be aware, this function will search in … Read more

How to redirect on particular page in wordpress? [closed]

You should get ID of the page you’re looking for: $page = get_page_by_title(‘thank-you’); wp_redirect(get_permalink($page->ID)); exit; It looks like you want to get page by slug. If that’s the case, you should use this function instead. Also, for Location header don’t use space after “Location” string: header(“Location: http://localhost/mysite/faq”);

Get Permalink for the top level parent of child pages

Here’s a way to get the top page url: $top_page_url = get_permalink( array_slice( get_ancestors( get_the_ID(), ‘page’ ) , -1 ) ); where get_ancestors() returns an array containing all the parents (ID) of the given page. You can read more about it in the Codex here. Here are various ways to get the last array item, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)