get custom post archieve by month

I had some problem with wp_get_archives, you can try my solution of this issue function get_cpt_archives( $cpt, $echo = false ) { global $wpdb; $sql = $wpdb->prepare(“SELECT * FROM $wpdb->posts WHERE post_type = %s AND post_status=”publish” GROUP BY YEAR(wp_posts.post_date), MONTH(wp_posts.post_date) ORDER BY wp_posts.post_date DESC”, $cpt); $results = $wpdb->get_results($sql); if ( $results ){ $archive = array(); … Read more

Send data using GET method not work correctly

Your question is a little unclear. What exact information are you trying to obtain and can you post a code example? The login information is set via a cookie so perhaps this is what you’re looking for? It’s only used for /wp-admin/ and it’s hashed so this might not work for your example. See here … Read more

Divide WP_Query posts by date & post type

The post_type isn’t really a meta query – therefore, both of these post_types would at least 1 category added/queried in order to get the filter invoked – using plain SQL is still a last resort. add_filter( ‘posts_groupby’, ‘my_posts_groupby’ ); function my_posts_groupby($groupby) { global $wpdb; $groupby = “{$wpdb->posts}.post_date”; return $groupby; } According to your example (I’d … Read more

Dynamically Generating User Meta Field

After some help with a PHP developer, it seems the main code above was close but certain changes were made. Here is the code for those interested. In this code, the custom post type is: Course. Change accordingly if needed for your own use. function save_educadme_courses_for_user( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) … Read more

Redirect Pretty Permalinks to Ugly Permalinks

You can do this in the WordPress Admin panel. Navigate to Settings > Permalinks and choose “Default.” This will reset your link structure to default. After saving, you should clear your cache and it should work. However, this will not change your html pages or any other links that is hard coded into the template … Read more