Astra_Ext_Advanced_Hooks_Loader::add_duplicate_action( array $actions, object $post )

Add duplicate action to post row actions.


Description


Parameters

$actions

(array) (Required) The actions for the post.

$post

(object) (Required) The post object.


Return

(array)


Source

File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-loader.php

		public function add_duplicate_action( $actions, $post ) {
			if ( ASTRA_ADVANCED_HOOKS_POST_TYPE !== $post->post_type || ! current_user_can( 'edit_post', $post->ID ) ) {
				return $actions;
			}

			$url = wp_nonce_url(
				add_query_arg(
					array(
						'post'   => $post->ID,
						'action' => 'ast_duplicate_layout',
					),
					admin_url( 'admin.php' ) 
				),
				'ast_duplicate_layout_' . $post->ID,
				'ast_duplicate_nonce'
			);

			$actions['duplicate'] = '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Duplicate', 'astra-addon' ) . '</a>';

			return $actions;
		}

Changelog

Changelog
Version Description
4.11.13 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.