TinyMCE Autoresize

Here’s a solution. There’s a slight problem as it does not recognize when images are added to the editor. 1: Create a folder with the name tinymce-autoresize in the plugins folder. 2. Create a file in tinymce-autoresize named tinymce_autoresize.php with this content: function intialize_autoresize_plugin() { // Check user permission if ( ! current_user_can(‘edit_posts’) && ! … Read more

How to display and use all existing tags at my write-post-at-frontend-panel?

try something like this: <?php $taxonomies = array( ‘wissen_tags’ ); $args = array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => false ); $terms = get_terms($taxonomies,$args); if (count($terms) > 0): i = 0; foreach ($terms as $term): ?> <div class=”wissen_tag_list”> <input type=”radio” value=”<?php echo $term->term_id; ?>” name=”wissen_tags” class=”wissen_tag_list_ckb” <?php if ( $i == 0 ) … Read more

Adding a Nav menu to post admin

To see how such a list can be created look at the code in wp-admin/includes/nav-menu.php. Unfortunately, it is hard coded there, so you have to re-create the code. First, let’s create two menus: We can get these menus in PHP with wp_get_nav_menus() (a wrapper for get_terms()): $menus = wp_get_nav_menus(); print ‘<pre>’ . htmlspecialchars( print_r( $menus, … Read more

What is the action or filter for changing permalink in Edit Post/Page?

You can use the the_permalink filter to modify permalinks. Take a look at the function reference for the same. Code sample from the docs: Append the query string for the current page to permalink URLs function append_query_string($url) { return add_query_arg($_GET, $url); } add_filter(‘the_permalink’, ‘append_query_string’); More information on permalinks: Here (StackOverflow) Here (Elegant Themes) And here … Read more

Automatically set page order on create page

You could use ajax and the admin_footer-post-new.php hook. The sql would vary depending on whether you want the highest or most recently published order number. The following returns the highest published order number + 1: function wpse155926_set_menu_order() { $ret = array(); if ( check_ajax_referer( ‘wpse155926_set_menu_order_post’, ‘nonce’, false /*die*/ ) ) { global $wpdb; //last published … Read more

How to replace default icon on “Add Media” button?

CSS is the way to go here. Add a new CSS for admin using the admin_enqueue_scripts hook in your child theme functions.php (if you don’t have one, you’re doing something wrong) function my_admin_enqueue_style() { wp_enqueue_style(‘my-css’, get_stylesheet_directory_uri().’/css/my-admin.css’, array(), ‘1.0.0’); } add_action(‘admin_enqueue_scripts’, ‘my_admin_enqueue_style’); In your my-admin.css file /* change the content to another Dashicon */ #wp-content-editor-tools .wp-media-buttons … Read more

WordPress MultiSite Paste from Word Tool Does not work

Problem was the page encoding. The wordpress database is UTF-8, i had switched the default to ISO-[something] to match the database we’re using to populate additional content and had not noticed any issue for over a month- until we started populating the blogs section of this page. We discovered the problem by following the code … Read more

Publish post when edit post form submitted with enter/return pressed on keyboard

you may add a filter on wp_insert_post_data: add_filter( ‘wp_insert_post_data’, ‘my_force_publish_post’, 10, 2 ); function my_force_publish_post( $data, $postarr ) { if ( ! isset($postarr[‘ID’]) || ! $postarr[‘ID’] ) return $data; if ( $postarr[‘post_type’] !== ‘inventory’ ) return $data; $old = get_post( $postarr[‘ID’] ); // the post before update if( $old->post_status !== ‘draft’ ) { // force … Read more

Restrict acceess of a page in backend

This can be done in two steps. First, add a hook to the page /wp-admin/edit.php?post_type=page to remove the desired page from appearing to other users. And another hook to redirect non-authorized users from trying to access the page directly /wp-admin/post.php?post=ID&action=edit. Here, the post type is page, but it can be changed to any other. Make … Read more

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