How to check from which page the user is coming to the current page?
How to check from which page the user is coming to the current page?
How to check from which page the user is coming to the current page?
Give WPCLI’s search-replace command a try: https://developer.wordpress.org/cli/commands/search-replace/ WPCLI is cross-platform and the search-replace command handles serialized data.
I think that hook fires after the post status has been updated. Try this add_action( ‘pre_post_update’, ‘intercept_adherence_publishing’, 10, 2); function intercept_adherence_publishing ($post_ID, $data ) { if (get_post_type($post_ID) !== ‘protocol-adherence’) { return; } $post = get_post($post_ID); $adherence_status = $_POST[‘_adherence_status’]; if ( ( $data[‘post_status’] === ‘publish’ ) && ( $post->post_type == ‘protocol-adherence’ ) && ( $adherence_status !== … Read more
Well, inside your directory just keep a normal php file like my-page.php, and then create a vanity URL for it using .htaccess. Open your .htaccess file (if present in the nstallation directory) or create one RewriteEngine On RewriteRule ^my-page-slug my-page.php Should be good update if you want to access WP posts and other objects, you … Read more
You are going on the wrong way.This will create difficulties and is NOT WORDPRESS STANDARD.Wordpress has a ajax technique to implement this. Call the ajax from your page <script> var data = { ‘action’: ‘insert_data_customtable’, ‘first_name’: firstname, ‘last_name’: lastname }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php … Read more
You can do that by using 2 different menus (wp_nav_menu). use is_user_logged_in conditional tag and apply a different menu accordingly: if (is_user_logged_in()) { wp_nav_menu(array(‘theme_location’ => ‘logged_user’ )); } else { wp_nav_menu(array(‘theme_location’ => ‘new_user’ )); } Edit This code goes where you’d usually put your regular menu in the theme – probably header.php Also, make sure … Read more
Thanks everybody for your answers. You bring me value clues. Finally I opted to make the query directly from wordpress page with the wordpress sintax for the defaults wordpress tables, using a little trick: Including my custom tables in wp-includes/wp-db.php. wordpress code: <?php global $current_user; get_currentuserinfo(); $user = $current_user->ID; global $wpdb; global $result; $courses = … Read more
Just found the solution in another question of Stack Overflow. Using the function register_meta(): register_meta(‘user’, ‘icq’, array( “type” => “string”, “show_in_rest” => true )); Now I can make a request using: { “username” : “johndoe”, “email”: “[email protected]”, “password”: “qwerty”, “meta”: { “icq”: “11223344” } } And the response are: { “id”: 49, “username”: “johndoe”, “name”: … Read more
Firstly, never send the browser directly to a PHP file in your theme or plugin. It’s a security hole and leads to a very fragile setup. For example: The file will work even if the theme is deactivated and will work for all sites on an install, not just those it’s enabled for The file … Read more
The best way to customize a navigation menu is to use a custom ‘walker’ function.. Here are the steps how to achieve the customization that you want! Create a “wp-custom-nav-walker.php” file in your theme directory for a new custom ‘walker’ class. Extend the Walker_Nav_Menu class and copy the class’ function that you want to modify … Read more