Storing form data into wordpress database [closed]

This is a simple code to add a form in a page: add_shortcode( ‘myform’, ‘add_myform’ ); function add_myform( $atts ) { if ( isset( $_POST[‘myname’] ) ) { $myname = $_POST[‘myname’]; update_option( ‘myname’, $myname ); } else { $myname = get_option( ‘myname’ ); } $myform = “<form method=’post’ action=”>”; $myform .= “<input type=”text” name=”myname” value=”” … Read more

How to get value from wp_usermeta table in database?

You should be using add_user_meta instead of update_user_meta: if (isset($_POST[‘billing_cpf’])) { add_user_meta($customer_id, ‘billing_cpf’, $POST[‘billing_cpf’], true); } As this will only add the meta if it does not already exist – no update. (This will prevent this field from being updatable – unless by you another way.) Note: normally you could use something like this to … Read more

Refresh Customize Section (not preview)

It depends what “update” means. If you want just to hide or show the control, (like how WordPress sidebar area is appearing and disappearing when the sidebar is present or not) then you can use the active_callback parameter of the customize_control like this. Edit: Also, active_callback works on sections and panels too. If you want … Read more

Conditional tag

If it is a single page: is_single() returns TRUE. If a $post is in a specific category: in_category( $cat ) returns TRUE. It needs $cat as ID, name or (string) slug. Anyway: Searching for a list of conditional tags isn´t that hard.

Very Simple Geo targeting

I personally really like the GEO service provided by ip-api.com It is very simple to use and a sample PHP code to grab the countryCode would give you what you need very simply. You can do MUCH more and you can read the full doc on it but for your specific needs listed, here is … Read more

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