# learnpress/4.4.2/assets/src/js/admin/lp-duplicate-post.js

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.4.2. 31 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.4.2/code/assets/src/js/admin/lp-duplicate-post.js
- Raw: https://pluginprobe.com/plugins/learnpress/4.4.2/raw/assets/src/js/admin/lp-duplicate-post.js
- Modified: 2026-07-11T02:31:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.4.2/code/assets/src/js/admin/lp-duplicate-post.js#L10-L20`.

```javascript
( function( $ ) {
	const duplicatePost = function duplicatePost( e ) {
		e.preventDefault();

		const _self = $( this ),
			_id = _self.data( 'post-id' );

		$.ajax( {
			url: '',
			data: {
				'lp-ajax': 'duplicator',
				id: _id,
				nonce: lpGlobalSettings.nonce,
			},
			success( response ) {
				response = LP.parseJSON( response );

				if ( response.success ) {
					window.location.href = response.data;
				} else {
					alert( response.data );
				}
			},
		} );
	};

	$( function() {
		$( document ).on( 'click', '.lp-duplicate-row-action .lp-duplicate-post', duplicatePost );
	} );
}( jQuery ) );

```
