WP Redirect with user nickname/username
Try placing a header() function instead of wp_redirect, so header(“Location: mysite.com/profile/username”);
Try placing a header() function instead of wp_redirect, so header(“Location: mysite.com/profile/username”);
You create two date objects and compare with the diff() methode. $from = new DateTime( ‘1970-01-01’ ); $to = new DateTime(‘today’); $years = $from->diff($to)->y; $months = $from->diff($to)->m; echo $years . ‘ years and ‘ . $months . ‘ months.’; => 46 years and 1 months.
This fixed it… function xsmi_load_admin_script() { wp_register_style( ‘chosencss’, plugins_url( ‘assets/chosen.css’, __FILE__ ), true, ”, ‘all’ ); wp_register_script( ‘chosenjs’, plugins_url( ‘assets/chosen.jquery.js’, __FILE__ ), array( ‘jquery’ ), ”, true ); wp_enqueue_style( ‘chosencss’ ); wp_enqueue_script( ‘chosenjs’ ); }
Even if possible**, you should not do that. If plugin execution depends on load order then you do something terribly wrong. ** You can disable all plugins except for one that you will write and include the main plugin files in whatever order you want.
Few issues here. use add_filter() instead of apply_filters(), to register your custom callback. return the value within your filter’s callback. use the get_comments_number filter instead of the comments_number filter, since you only want to change the number and not the whole output of the comments_number() function. prefix the name of your custom callbacks, to avoid … Read more
Just make sure that all JS is inside the <script> tags and you can use PHP anywhere as long as it’s .php file and it’s inside the <?php and ?>. Simple as that! It’s kind of ugly and it’s far from super readable but that’s the way to do it. <?php $php_code=”My PHP is here!!”; … Read more
Thank to @pietergoosen for “jokingly” giving me the answer. function gm_gather_posts_in_array() { $set_days_before=”1275″; $posts_to_be_processed = date(‘Y-m-d’, strtotime(“today – $set_days_before days”)); $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘date_query’ => array( array( ‘before’ => $posts_to_be_processed ) ) ); $posts_to_be_processed = new WP_Query( … Read more
You can disable pagination per find() query in Pods by setting ‘pagination’ => false, I also suggest disabling search with ‘search’ => false. You can do this globally by setting these constants, which means you’ll have to explicitly enable search or pagination on the queries you want them enabled on by setting ‘pagination’ => true … Read more
You can add an action to wp_insert_post(). The cool thing about it is the third parameter – $update, because it allows you to only set the post_format once, and you can change it later. This is necessary because the function wp_insert_post() is not only called on the creation, but also on update etc. add_action( ‘wp_insert_post’, … Read more
You can use “get_page_link” function to Retrieves the permalink for the current page (if in The Loop) or any arbitrary page ID if passed as the first argument. something like this: <a href=”https://wordpress.stackexchange.com/questions/219011/<?php echo get_page_link( $page->ID ); ?>”><?php echo $page->post_title; ?></a> Reference: https://codex.wordpress.org/Function_Reference/get_page_link