Dynamic homepage according to user role

To use a different page’s content on the homepage based on a logged-in user’s role you can do this: In your functions.php file add this code: function wpse_273872_pre_get_posts( $query ) { if ( $query->is_main_query() && is_user_logged_in() ) { //work-around for using is_front_page() in pre_get_posts //known bug in WP tracked by https://core.trac.wordpress.org/ticket/21790 $front_page_id = get_option(‘page_on_front’); $current_page_id … Read more

Random and Erroneous WordPress Redirect

If the redirect comes from WordPress code, you can find out who is calling wp_redirect() by hooking into it: add_filter( ‘wp_redirect’, ‘wpse12721_wp_redirect’ ); function wpse12721_wp_redirect( $location ) { // Get a backtrace of who called us debug_print_backtrace(); // Cancel the redirect return false; }

How can I specify a category post on my home page

You really should be using custom posts to do what you’re trying to do, but to answer your question here’s a solution (put this in your functions.php file): add_shortcode( ‘job-posts’, ‘rt_list_posts_by_category’ ); function rt_list_posts_by_category($atts) { $a = shortcode_atts( array( ‘link1’ => ‘#’, ‘link2’ => ‘#’, ‘link3’ => ‘#’, ), $atts ); // arguments for function … Read more

Redirecting to home-page when saving any edited code

I experienced an issue similar to this several months ago. I was using a plugin to kill query strings from the URL for SEO purposes. Long story short the plugin was killing search pages and admin pages as well. As Chris_O mentioned the redirection plugin I encountered a similar redirection issue when track modify posts … Read more

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