get_terms adds slaces to the resualt

What you’d need to do is double-escape, so change echo ‘\” . $term->name . ‘\’, ‘; to echo ‘\\\” . $term->name . ‘\\\’, ‘; …but, you’d be much better off just using different encapsulators: <select class=”w-100″ name=”mf_term”> <option value=” <?php $terms = get_terms( ‘call-type’ ); if ( ! empty( $terms ) && ! is_wp_error( $terms … Read more

How to submit form in a PHP file in WordPress?

I want to submit it to the file sub.php(which is in same directory) Don’t do this. You should not have standalone PHP files that get queried via forms or AJAX etc, WordPress handles all the requests. By having a standalone file, you open a can of worms of security issues, and other problems ( you … Read more

Cannot prefill hidden Ninja Forms fields

According to https://developer.ninjaforms.com/codex/changing-field-values/ you need to add .trigger( ‘change’ ) when changing Ninfa Forms field values programmatically. This should work: if(jQuery(‘#broker-list’).length) { //checks if the list exists jQuery(document).on( ‘nfFormReady’, function( e, layoutView ) { var broker_name = “”; jQuery(document).on(“click”, “.broker” , function() { broker_name = jQuery(‘.broker__name’, this).text(); console.log(broker_name); // this works perfectly if(jQuery(‘#nf-field-33’).length) { jQuery(this).val(broker_name).trigger( … Read more

woocommerce registration form with klaviyo(don’t work with current user)

Hey guys there are just a few changes in the above code. Check this out it works for me. Note: Please change the LIST_ID to your klaviyo’s list id, and get one private key from your klaviyo account and add it at PRIVATE_API_KEY function send_coupon_to_freshly_registered_user($user_id) { $user = get_user_by(‘id’,$user_id); //new line $user_email = stripslashes($user->user_email); //changed … Read more

WP plugins for building a database?

WordPress natively stores content in a database. It sounds like you’re wanting to store info in that database, and retrieve and present it – rather than actually create a separate database. If that’s the case, creating custom post types are likely the way to go. An author can be a custom post type, which would … Read more

Send email button in custom post type backend

Solved this using AJAX. Here is my updated code: <?php add_action(‘wp_ajax_quote_email_pdf’, ‘quote_email_pdf’); function quote_email_pdf() { wp_mail( $to, $subject, $message, $headers, $attachments ); die(); } ?> <button class=”button” id=”downloadQuote”>Send email</button> <script> jQuery(document).ready(function($){ const fullName = $(‘#quoteFullName’).text(); const emailAddress = $(‘#quoteEmail a’).text(); $(‘#downloadQuote’).click(function(e){ e.preventDefault(); $.ajax({ url: sf_admin_ajax.sf_admin_ajax_url, type: ‘POST’, data: { action: ‘quote_email_pdf’, emailAddress: emailAddress, fullName: fullName … Read more

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