How to Maintain url on form submit

If your form is embedded in a shortcode or some other front end form, I would post to the permalink for the page. That’s more reliable than using action=”” in my experience. Then output something on that page to acknowledge the submission or show an error. $global $post; printf(‘<form method=”post” action=”%s”>’,get_permalink($post->ID)); or in for a … Read more

Calling WordPress hook from within a class: call to undefined function error

On this line: add_action(‘admin_menu’, array($this, ‘create_menu_item’)); You are correctly passing the create_menu_item method of the current class to callback argument of the add_action() function. You just need to apply the same principle for the callbacks in the add_menu_page() function: add_menu_page( $value->post_title, $value->post_title, ‘manage_options’, $value->post_name.’-admin-page.php’, array( $this, ‘create_admin_page’ ), // <– Here ‘dashicons-location-alt’, 6 ); This … Read more

Admin submenu does not call function to load the page

I found my solution. Problem of hrefs when the wordpress core did not find the function callback or it’s empty for the functions add_menu_page() and add_submenu_page() the href wil be generated like this : http(s)://my-site.org/wp-admin/my-slug-page, otherwise the href is in this format : http(s)://my-site.org/wp-admin/admin.php?page=my-slug-page So In my case, I had to be sure the functions … Read more

OOP development and hooks

Sally CJ raises a good point in their comment that it is probably better to have each class initialize its own actions and filters. I’ve been working with the same boiler plate for some time now and created my own version of this boiler plate on GitHub. In that version I have a Back\Hooks and … Read more

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