Modify Date Format to German

WordPress has a special function for translating dates, called date_i18n. General usage: echo date_i18n( $dateformatstring, $unixtimestamp, $gmt); Supposing you have German as your site’s language this would be: echo date_i18n( ‘j. F Y’, false, false); You can also import the time format from the admin settings, like this: echo date_i18n(get_option(‘date_format’), false, false);

How to fetch serialized data from wordpress options

No, this won’t work: <?php echo get_option(‘notice_data[Message]’); ?> Because get_option pulls whole option value by option_name, it doesn’t pull by pieces of the serialized array. What you are asking for is a key (option_name) called literally notice_data[Message]. Assuming you’ve saved the option as notice_data you aren’t going to get a match, and I am not … Read more

How to create a Page alias in WordPress

Those are actually post states; not aliases.. And you can do it through the display_post_states filter, like so, where we check if the post ID ($post->ID) is 123 and if so, we assign the XYZ Page state to that post (which could be a Page, Custom Post Type, etc.): add_filter( ‘display_post_states’, ‘my_post_states’, 10, 2 ); … Read more

save new data to wp_options non-post form

Load the existing option first and save the new data as an element in an array: // get the option $data = get_option( ‘row_name’ ); // add new data to the option $data[] = $options; // save it back to the db update_option( ‘row_name’, $data ); Your option will then be an array of arrays … Read more

Long option names fail silently?

You don’t get an error because WordPress does not check for the length, and MySQL silently truncates it (giving a warning, not an error), unless you enable the STRICT_ALL_TABLES option (which will change the warning into an error). Even more confusing, when you enable multisite the options are saved in the sitemeta table with a … Read more

Editor role not saving settings page for custom post type

In the wp-admin/options.php file you find filter with name created from your settings group to control permissions: $capability = apply_filters( “option_page_capability_{$option_page}”, $capability ); to fix issue, add filter with your desired permission level like: add_filter( ‘option_page_capability_programme_content’, ‘my_settings_permissions’, 10, 1 ); function my_settings_permissions( $capability ) { return ‘edit_pages’; }

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