Creating a WordPress addon for ContactForm7 submission (.XML file export)

The file is not created, because the function my_generate_xml exists, but is never called. All that code looks correct. The only problem is that you have to call the function that generates the XML file… add_action(‘wpcf7_before_send_mail’, ‘my_get_form_values’); function my_get_form_values($contact_form) { // get info about the form and current submission instance $formTitle = $contact_form->title(); $submission = … Read more

Get shortcode attribute for AJAX call

The problem is ordering. $srcDir is being set correctly, but when it’s set the call to wp_localize_script has already happened. Instead, consider changing your code to refer to a data attribute in the content that the shortcode returns. This also prevents the code being tied to only allowing a single instance per page. Additionally, there … Read more

Show custom taxonomy in theme

If you want to list out the custom taxonomy you have to use get_terms function For your requirement instead of creating new taxonomy you can modify the default category it self function custom_change_cat_object() { global $wp_taxonomies; $labels = &$wp_taxonomies[‘category’]->labels; $labels->name=”Author”; $labels->singular_name=”Author”; $labels->add_new = ‘Add Author’; $labels->add_new_item = ‘Add Author’; $labels->edit_item = ‘Edit Author’; $labels->new_item = … Read more

How do I restrict a second admin certain access?

I think this code will prevent certain users from getting into any part of the admin area (not tested): add_filter(‘admin_menu’, ‘block_users’); function block_users() { $current_user = wp_get_current_user(); // get current user object $allowed_user=”[email protected]”; // change to allowed user email if (! $current_user->user_login == $allowed_user) { wp_redirect(admin_url()); // redirect to dashboard exit; // to exit this … Read more