Redirect to page list when page published

I have the below code which works as expected if anyone else is looking for similar. add_action( ‘publish_page’, ‘redirect_user_page_list’, 10, 3 ); function redirect_user_page_list() { if( is_user_logged_in() ) { $user = wp_get_current_user(); $role = ( array ) $user->roles; if ( ‘role_slug’ == $role[0] ) { $url=”url to redirect to”; wp_redirect($url); exit; } } }

Remove ID page from wp_count

This should work for you to exclude via ID: //replace the 3,8 with your page ids <?php $args=array( ‘post__not_in’ => array(3,8), ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ); query_posts($args); ?> If you want to exclude via page title you can do this <?php $exclude1 = get_page_by_title(‘Sample Page Title’); ?> <?php $exclude2 = get_page_by_title(‘Sample Page Title … Read more

I Changed the Menu Order, But the Page Order Didn’t Change on Front Page

By default, posts and pages are sorted after the date. If you want sort pages by “order” field, which is visible on edit page, you have to set orderby parameter: add_action(‘pre_get_posts’, ‘change_order’); function change_order($query) { if ( is_front_page() || is_home() ) { $query->set( ‘orderby’, ‘menu_order’ ); $query->set( ‘order’, ‘ASC’ ); } return $query; } Put … Read more

Show own shortcode data on each page

Best way to achieve the desired functionality is to use post_meta / custom field. add_shortcode (‘cities’, ‘show_cities’); function show_cities(){ /* Create a custom field ‘city’ to save city name in page editor */ $city = get_post_meta( get_the_id(), ‘city’, true ); return $city; } Using an array can also do the work as under: add_shortcode (‘cities’, … Read more

Can’t see content on page to edit

Hard to say without more information. Are you trying to make an edit to the page that displays events, or one of the events itself? If you’re trying to edit the Events they should have their own Custom Post Type in the sidebar of the dashboard.

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