Redirect sub-page URLs to parent without changing URL
Milo’s comment got me there: add_rewrite_rule( “^{$slug}/”, “index.php?location={$slug}”, //changed query var to location ‘top’ );
Milo’s comment got me there: add_rewrite_rule( “^{$slug}/”, “index.php?location={$slug}”, //changed query var to location ‘top’ );
The first issue I see is the ajax url is incorrect. Your wp_localize_script() has the handle name ‘main’, not ‘ajax_object’. url: main.ajaxurl Also, where is the callback code to handle the get_program_by_category ajax action? You’re missing two actions. add_action( ‘wp_ajax_my_action’, ‘my_action_callback’ ); add_action( ‘wp_ajax_nopriv_my_action’, ‘my_action_callback’ ); See the WordPress Codex to learn more about using … Read more
I think that the cookie is the best if not the only solution… Cookie can be implemented by php or js and is your choiche to choose the right method: Depending on: the client needs (they have to work also if js is not present?), the number of custom posts and site traffic (they can … Read more
WordPress provides the Conditional Tags. I think is_user_logged_in() tag will work for you. List of conditional tags available. if ( is_user_logged_in() ) { // include the JavaScript File } UPDATE: Also if you want to check the user roles etc.. you can use the current_user_can() you can check both the both roles and capabilities. Better … Read more
The press_this_save_post filter can be used to change the post type from post to page. Add the following code to your theme’s functions.php or a plugin: add_filter( ‘press_this_save_post’, ‘wpse244633_press_this_save_post’ ); /** * Filter the post data of a Press This post before saving/updating. * * @param array $post_data The post data. * @return array */ … Read more
You can use set_transient to write temporary data to the database and get_transient to read the value back. This keeps the data on the server and available across requests. It’s kind like a nonce. Keep in mind writing to your database can jam things up when you get a significant amount of users. If you … Read more
Basically you are asking a function to check the post author role. You can use user_can() function. if(user_can(‘administrator’)) { //Write your code if the admin } current_user_can() : https://codex.wordpress.org/Function_Reference/current_user_can user_can() : https://codex.wordpress.org/Function_Reference/user_can
load-scripts.php loads incorrect file names
fist of all set radio two radio button and give a name related like “cf_current_list” and have you set save button if yes then set code in functions.php file like if(isset($_REQUEST[‘buuton_nm’])){ if ( get_option( cf_current_list ) !== false ) { // The option already exists, so we just update it. update_option( cf_current_list, $_REQUEST[‘radio_btn_nm’] ); } … Read more
So the problem with injection is going to be that the javascript is only going to run after everything has loaded, which means that the, and it needs to make the all the image requests to the server again. Unfortunately, you probably can’t make the requests any earlier than they’re already being made, since they’re … Read more